diff options
Diffstat (limited to 'libexec/mail.local/mail.local.c')
-rw-r--r-- | libexec/mail.local/mail.local.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/libexec/mail.local/mail.local.c b/libexec/mail.local/mail.local.c index fb98d49b638..a1d38550953 100644 --- a/libexec/mail.local/mail.local.c +++ b/libexec/mail.local/mail.local.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)mail.local.c 5.6 (Berkeley) 6/19/91";*/ -static char rcsid[] = "$Id: mail.local.c,v 1.13 1997/03/28 02:16:40 millert Exp $"; +static char rcsid[] = "$Id: mail.local.c,v 1.14 1997/03/29 02:59:56 millert Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -166,8 +166,11 @@ dohold() } holdfd = getlock(from, pw); - if (holdfd == -1) + if (holdfd == -1) { + write(STDOUT_FILENO, "0\n", 2); return (1); + } + write(STDOUT_FILENO, "1\n", 2); while (read(0, &c, 1) == -1 && errno == EINTR) ; @@ -317,17 +320,21 @@ again: /* * Only root can write the spool directory. */ - if ((lfd = open(lpath, O_CREAT|O_WRONLY|O_EXCL, - S_IRUSR|S_IWUSR)) < 0) { - err(NOTFATAL, "%s: %s", lpath, strerror(errno)); - return(-1); + while (1) { + if ((lfd = open(lpath, O_CREAT|O_WRONLY|O_EXCL, + S_IRUSR|S_IWUSR)) != -1) + break; + if (tries > 9) { + err(NOTFATAL, "%s: %s", lpath, strerror(errno)); + return(-1); + } + sleep(1 << tries); + tries++; } } return (lfd); } - - int deliver(fd, name, lockfile) int fd; |