xfs: Check for extent overflow when moving extent from cow to data fork
[xfstests-dev.git] / src / t_futimens.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Check ctime updates when calling futimens without UTIME_OMIT for the
4  * mtime entry.
5  * Copyright (c) 2009 Eric Blake <ebb9@byu.net>
6  */
7 #include <fcntl.h>
8 #include <unistd.h>
9 #include <stdio.h>
10 #include <sys/stat.h>
11
12 int
13 main(int argc, char **argv)
14 {
15         int fd = creat ("file", 0600);
16         struct stat st1, st2;
17         struct timespec t[2] = { { 1000000000, 0 }, { 0, UTIME_OMIT } };
18
19         fstat(fd, &st1);
20         sleep(1);
21         futimens(fd, t);
22         fstat(fd, &st2);
23
24         if (st1.st_ctime == st2.st_ctime)
25                 printf("failed to update ctime!\n");
26         return 0;
27 }