utimens.c: work around a probable Linux kernel bug
authorJim Meyering <meyering@redhat.com>
Wed, 4 Jun 2008 17:32:50 +0000 (19:32 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 5 Jun 2008 06:44:54 +0000 (08:44 +0200)
* 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.

ChangeLog
lib/utimens.c

index 6c165cd..c3f7d41 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 134310b..d80445c 100644 (file)
@@ -103,6 +103,18 @@ gl_futimens (int fd ATTRIBUTE_UNUSED,
   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;
     }