bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I: coreutils-20041123: src/touch.c regression


From: Paul Eggert
Subject: Re: I: coreutils-20041123: src/touch.c regression
Date: Mon, 03 Jan 2005 11:58:35 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Jim Meyering <address@hidden> writes:

> "Dmitry V. Levin" <address@hidden> wrote:
>> +      if (errno != ENOSYS && errno != ENOENT)
>
> Thanks.
> I've made that change.

On further thought, this looks like a classic example where we should
be testing for known valid error numbers rather than adding bogus
error numbers as reports come in from the field.  So I installed this:

2005-01-03  Paul Eggert  <address@hidden>

        * utimens.c (futimens): Robustify the previous patch, by checking
        for known valid error numbers rather than observed invalid ones.

--- utimens.c   3 Jan 2005 19:23:09 -0000       1.5
+++ utimens.c   3 Jan 2005 19:54:54 -0000       1.6
@@ -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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]