movemail: treat EACCES etc. failures as permanent
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Nov 2012 08:28:06 +0000 (00:28 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Nov 2012 08:28:06 +0000 (00:28 -0800)
* movemail.c (main): Treat any link failure other than EEXIST as a
permanent failure, not just EPERM.  EACCES, for example.

lib-src/ChangeLog
lib-src/movemail.c

index 8e83579..b85ba12 100644 (file)
@@ -1,3 +1,9 @@
+2012-11-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       movemail: treat EACCES etc. failures as permanent
+       * movemail.c (main): Treat any link failure other than EEXIST as a
+       permanent failure, not just EPERM.  EACCES, for example.
+
 2012-11-21  Paul Eggert  <eggert@cs.ucla.edu>
 
        Assume POSIX 1003.1-1988 or later for unistd.h (Bug#12945).
index adc5dd9..264b3d2 100644 (file)
@@ -328,11 +328,8 @@ main (int argc, char **argv)
 
          tem = link (tempname, lockname);
 
-#ifdef EPERM
-         if (tem < 0 && errno == EPERM)
-           fatal ("Unable to create hard link between %s and %s",
-                  tempname, lockname);
-#endif
+         if (tem < 0 && errno != EEXIST)
+           pfatal_with_name (lockname);
 
          unlink (tempname);
          if (tem >= 0)