check: Remount file system if MOUNT_OPTIONS changed
[xfstests-dev.git] / src / t_futimens.c
1 /*
2  * Check ctime updates when calling futimens without UTIME_OMIT for the
3  * mtime entry.
4  *
5  * Copyright (c) 2009 Eric Blake <ebb9@byu.net>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  */
12 #include <fcntl.h>
13 #include <unistd.h>
14 #include <stdio.h>
15 #include <sys/stat.h>
16
17 int
18 main(int argc, char **argv)
19 {
20         int fd = creat ("file", 0600);
21         struct stat st1, st2;
22         struct timespec t[2] = { { 1000000000, 0 }, { 0, UTIME_OMIT } };
23
24         fstat(fd, &st1);
25         sleep(1);
26         futimens(fd, t);
27         fstat(fd, &st2);
28
29         if (st1.st_ctime == st2.st_ctime)
30                 printf("failed to update ctime!\n");
31         return 0;
32 }