-]], [[struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } };
- struct stat st;
- const char *f = "conftest.file";
- if (close (creat (f, 0600))) return 1;
- if (utimensat (AT_FDCWD, f, NULL, AT_SYMLINK_NOFOLLOW)) return 2;
- if (utimensat (AT_FDCWD, f, ts, 0)) return 3;
- sleep (1);
- ts[0].tv_nsec = UTIME_NOW;
- ts[1].tv_nsec = UTIME_OMIT;
- if (utimensat (AT_FDCWD, f, ts, 0)) return 4;
- if (stat (f, &st)) return 5;
- if (st.st_ctime < st.st_atime) return 6;]])],
+]], [[int result = 0;
+ const char *f = "conftest.file";
+ if (close (creat (f, 0600)))
+ return 1;
+ /* Test whether the AT_SYMLINK_NOFOLLOW flag is supported. */
+ {
+ if (utimensat (AT_FDCWD, f, NULL, AT_SYMLINK_NOFOLLOW))
+ result |= 2;
+ }
+ /* Test whether UTIME_NOW and UTIME_OMIT work. */
+ {
+ struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } };
+ if (utimensat (AT_FDCWD, f, ts, 0))
+ result |= 4;
+ }
+ sleep (1);
+ {
+ struct timespec ts[2] = { { 1, UTIME_NOW }, { 1, UTIME_OMIT } };
+ struct stat st;
+ if (utimensat (AT_FDCWD, f, ts, 0))
+ result |= 8;
+ if (stat (f, &st))
+ result |= 16;
+ else if (st.st_ctime < st.st_atime)
+ result |= 32;
+ }
+ return result;
+ ]])],
+dnl FIXME: simplify this in 2012, when file system bugs are no longer common