utimens: work around Linux ctime bug
authorEric Blake <ebb9@byu.net>
Thu, 17 Dec 2009 23:57:37 +0000 (16:57 -0700)
committerEric Blake <ebb9@byu.net>
Sat, 19 Dec 2009 23:57:22 +0000 (16:57 -0700)
commit68f0f1af0f2cc75615d89234494dca043e99a73d
tree0353f8cae94f6d34d13932bc7fa916b4ca263af2
parent9963a98120addb9fd80299e5242554d62b002217
utimens: work around Linux ctime bug

Force a ctime update by using stat() before any utimensat call
with mtime of UTIME_OMIT.  But avoid extra stat()s in later
calls, by doing extra work on the first instance in order to
cache whether the bug is actually present.

* lib/utimens.c (detect_ctime_bug): New helper function.
(update_timespec): Differentiate between workaround needed for
this bug vs. what is needed for systems that lack utimensat.
(fdutimens, lutimens): Work around bug.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/utimens.c