]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(futimens): Robustify the previous patch, by checking
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Jan 2005 19:54:54 +0000 (19:54 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Jan 2005 19:54:54 +0000 (19:54 +0000)
for known valid error numbers rather than observed invalid ones.

lib/utimens.c

index c3949771731eff7e503c1b8ef599d230b31c3ad4..4448f19f4777b1f57be7c56e9bf3d1e0ac505c05 100644 (file)
@@ -81,10 +81,16 @@ futimens (int fd ATTRIBUTE_UNUSED,
        return 0;
 
       /* On GNU/Linux without the futimes syscall and without /proc
-        mounted, glibc futimes fails with errno == ENOENT or ENOSYS.
-        Fall back on utimes in this case.  */
-      if (errno != ENOENT && errno != ENOSYS)
-       return -1;
+        mounted, glibc futimes fails with errno == ENOENT.  Fall back
+        on utimes if we get a weird error number like that.  */
+      switch (errno)
+       {
+       case EACCES:
+       case EIO:
+       case EPERM:
+       case EROFS:
+         return -1;
+       }
     }
 # endif
   return utimes (file, t);