2 * Tests for the utimens functions
18 char tmpfile1
[] = "/tmp/testutimens1.XXXXXX";
19 char tmpfile2
[] = "/tmp/testutimens2.XXXXXX";
20 int tmpfd1
= mkstemp(tmpfile1
);
21 int tmpfd2
= mkstemp(tmpfile2
);
24 struct timespec times
[2];
26 times
[0].tv_nsec
= 271828;
28 times
[1].tv_nsec
= 314159;
30 if (-1 == futimens(tmpfd1
, times
))
32 perror("futimens failed:");
35 DIR* tmpdir
= opendir("/tmp");
37 int tmpdirfd
= dirfd(tmpdir
);
38 if (-1 == utimensat(tmpdirfd
, tmpfile2
+5, times
, AT_SYMLINK_NOFOLLOW
))
40 perror("utimensat failed:");
47 struct timespec badtimes
[2];
49 char* badname
= strdup("foo");
51 futimens(badfd
, badtimes
);
52 utimensat(badfd
, badname
, badtimes
, badfd
);