- if (result == 0 && utimensat_ctime_really == 0 && times
- && times[0].tv_nsec != UTIME_OMIT
- && times[1].tv_nsec == UTIME_OMIT)
- {
- /* Perform a followup [l]stat. See detect_ctime_bug in
- utimens.c for more details. */
- struct timespec now;
- if (fstatat (fd, file, &st2, flag))
- return -1;
- if (st1.st_ctime != st2.st_ctime
- || get_stat_ctime_ns (&st1) != get_stat_ctime_ns (&st2))
- {
- utimensat_ctime_really = 1;
- return result;
- }
- if (times[0].tv_nsec == UTIME_NOW)
- now = get_stat_atime (&st2);
- else
- gettime (&now);
- if (now.tv_sec < st2.st_ctime
- || 2 < now.tv_sec - st2.st_ctime
- || (get_stat_ctime_ns (&st2)
- && now.tv_sec - st2.st_ctime < 2
- && (20000000 < (1000000000 * (now.tv_sec - st2.st_ctime)
- + now.tv_nsec
- - get_stat_ctime_ns (&st2)))))
- utimensat_ctime_really = -1;
- ts[0] = times[0];
- ts[1] = get_stat_mtime (&st2);
- result = utimensat (fd, file, ts, flag);
- }