diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-05-06 06:37:42 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-05-06 06:37:42 -0700 |
commit | 7a6018ad21c87ae7adda785b115851d662d5c2e9 (patch) | |
tree | def91c95086666d3e4441bc60f774c566dd5ebdb /lib | |
parent | d491e7a83f5fc1127483a42a1d2b6a0474c8b222 (diff) | |
download | emacs-7a6018ad21c87ae7adda785b115851d662d5c2e9.tar.gz |
Merge from gnulib.
This incorporates:
2013-04-30 utimens, utimensat: work around Solaris UTIME_OMIT bug
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utimens.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/utimens.c b/lib/utimens.c index 87123605ba2..013843d6da4 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -216,15 +216,19 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) if (0 <= utimensat_works_really) { int result; -# if __linux__ +# if __linux__ || __sun /* As recently as Linux kernel 2.6.32 (Dec 2009), several file systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT, but work if both times are either explicitly specified or UTIME_NOW. Work around it with a preparatory [f]stat prior to calling futimens/utimensat; fortunately, there is not much timing impact due to the extra syscall even on file systems - where UTIME_OMIT would have worked. FIXME: Simplify this in - 2012, when file system bugs are no longer common. */ + where UTIME_OMIT would have worked. + + The same bug occurs in Solaris 11.1 (Apr 2013). + + FIXME: Simplify this for Linux in 2016 and for Solaris in + 2024, when file system bugs are no longer common. */ if (adjustment_needed == 2) { if (fd < 0 ? stat (file, &st) : fstat (fd, &st)) @@ -236,7 +240,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) /* Note that st is good, in case utimensat gives ENOSYS. */ adjustment_needed++; } -# endif /* __linux__ */ +# endif # if HAVE_UTIMENSAT if (fd < 0) { @@ -445,15 +449,19 @@ lutimens (char const *file, struct timespec const timespec[2]) if (0 <= lutimensat_works_really) { int result; -# if __linux__ +# if __linux__ || __sun /* As recently as Linux kernel 2.6.32 (Dec 2009), several file systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT, but work if both times are either explicitly specified or UTIME_NOW. Work around it with a preparatory lstat prior to calling utimensat; fortunately, there is not much timing impact due to the extra syscall even on file systems where - UTIME_OMIT would have worked. FIXME: Simplify this in 2012, - when file system bugs are no longer common. */ + UTIME_OMIT would have worked. + + The same bug occurs in Solaris 11.1 (Apr 2013). + + FIXME: Simplify this for Linux in 2016 and for Solaris in + 2024, when file system bugs are no longer common. */ if (adjustment_needed == 2) { if (lstat (file, &st)) @@ -465,7 +473,7 @@ lutimens (char const *file, struct timespec const timespec[2]) /* Note that st is good, in case utimensat gives ENOSYS. */ adjustment_needed++; } -# endif /* __linux__ */ +# endif result = utimensat (AT_FDCWD, file, ts, AT_SYMLINK_NOFOLLOW); # ifdef __linux__ /* Work around a kernel bug: |