aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/movemail.c
diff options
context:
space:
mode:
authorTom Tromey2012-12-17 07:56:22 -0700
committerTom Tromey2012-12-17 07:56:22 -0700
commit3d6eced1ae51ffd0a782130e7c334052277e2724 (patch)
tree5d1d2ad7cd3374f922886c4a72062511a035c168 /lib-src/movemail.c
parentbf69f522a9e135f9aa483cedd53e71e915f2bf75 (diff)
parent7c3d167f48d6262ee4e5512aa50a07ee96bc1509 (diff)
downloademacs-3d6eced1ae51ffd0a782130e7c334052277e2724.tar.gz
emacs-3d6eced1ae51ffd0a782130e7c334052277e2724.zip
merge from trunk
Diffstat (limited to 'lib-src/movemail.c')
-rw-r--r--lib-src/movemail.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 32d32e69abf..f2b2484c8e3 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -65,9 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
65 65
66#include <getopt.h> 66#include <getopt.h>
67#include <unistd.h> 67#include <unistd.h>
68#ifdef HAVE_FCNTL_H
69#include <fcntl.h> 68#include <fcntl.h>
70#endif
71#include <string.h> 69#include <string.h>
72#include "syswait.h" 70#include "syswait.h"
73#ifdef MAIL_USE_POP 71#ifdef MAIL_USE_POP
@@ -98,13 +96,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
98#include <fcntl.h> 96#include <fcntl.h>
99#endif /* WINDOWSNT */ 97#endif /* WINDOWSNT */
100 98
101#ifndef F_OK
102#define F_OK 0
103#define X_OK 1
104#define W_OK 2
105#define R_OK 4
106#endif
107
108#ifdef WINDOWSNT 99#ifdef WINDOWSNT
109#include <sys/locking.h> 100#include <sys/locking.h>
110#endif 101#endif
@@ -337,11 +328,8 @@ main (int argc, char **argv)
337 328
338 tem = link (tempname, lockname); 329 tem = link (tempname, lockname);
339 330
340#ifdef EPERM 331 if (tem < 0 && errno != EEXIST)
341 if (tem < 0 && errno == EPERM) 332 pfatal_with_name (lockname);
342 fatal ("Unable to create hard link between %s and %s",
343 tempname, lockname);
344#endif
345 333
346 unlink (tempname); 334 unlink (tempname);
347 if (tem >= 0) 335 if (tem >= 0)
@@ -442,22 +430,10 @@ main (int argc, char **argv)
442 for certain failure codes. */ 430 for certain failure codes. */
443 if (status < 0) 431 if (status < 0)
444 { 432 {
445 if (++lockcount <= 5) 433 if (++lockcount <= 5 && (errno == EAGAIN || errno == EBUSY))
446 { 434 {
447#ifdef EAGAIN 435 sleep (1);
448 if (errno == EAGAIN) 436 goto retry_lock;
449 {
450 sleep (1);
451 goto retry_lock;
452 }
453#endif
454#ifdef EBUSY
455 if (errno == EBUSY)
456 {
457 sleep (1);
458 goto retry_lock;
459 }
460#endif
461 } 437 }
462 438
463 pfatal_with_name (inname); 439 pfatal_with_name (inname);