changeset 10160:e9419491977a

utimens.c: work around a probable Linux kernel bug * lib/utimens.c (gl_futimens) [HAVE_UTIMENSAT]: Work around what appears to be a kernel bug that causes utimensat to return 280 instead of 0, indicating success.
author Jim Meyering <meyering@redhat.com>
date Wed, 04 Jun 2008 19:32:50 +0200
parents 873cd96bbc65
children 5d2f07baed4c
files ChangeLog lib/utimens.c
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jun 05 00:56:52 2008 +0200
+++ b/ChangeLog	Wed Jun 04 19:32:50 2008 +0200
@@ -1,3 +1,11 @@
+2008-06-05  Jim Meyering  <meyering@redhat.com>
+	    Paul Eggert  <eggert@cs.ucla.edu>
+
+	utimens.c: work around a probable Linux kernel bug
+	* lib/utimens.c (gl_futimens) [HAVE_UTIMENSAT]: Work around what
+	appears to be a kernel bug that causes utimensat to return 280
+	instead of 0, indicating success.
+
 2008-06-04  Bruno Haible  <bruno@clisp.org>
 
 	* lib/copy-acl.c (qcopy_acl): Call qset_acl, not set_acl. Fixes
--- a/lib/utimens.c	Thu Jun 05 00:56:52 2008 +0200
+++ b/lib/utimens.c	Wed Jun 04 19:32:50 2008 +0200
@@ -103,6 +103,18 @@
   if (fd < 0)
     {
       int result = utimensat (AT_FDCWD, file, timespec, 0);
+#ifdef __linux__
+      /* Work around what might be a kernel bug:
+         http://bugzilla.redhat.com/442352
+         http://bugzilla.redhat.com/449910
+         It appears that utimensat can mistakenly return 280 rather
+         than 0 to indicate success.
+         FIXME: remove in 2010 or whenever the offending kernels
+         are no longer in common use.  */
+      if (0 < result)
+        result = 0;
+#endif
+
       if (result == 0 || errno != ENOSYS)
         return result;
     }