Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/mail If we fail 5 times in a row, fail correctly (St...



details:   https://anonhg.NetBSD.org/src/rev/6f5bc3f9aee1
branches:  trunk
changeset: 339205:6f5bc3f9aee1
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jul 04 15:09:49 2015 +0000

description:
If we fail 5 times in a row, fail correctly (Steffen Nurpmeso).

diffstat:

 usr.bin/mail/dotlock.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 96c36dd816e7 -r 6f5bc3f9aee1 usr.bin/mail/dotlock.c
--- a/usr.bin/mail/dotlock.c    Sat Jul 04 13:36:25 2015 +0000
+++ b/usr.bin/mail/dotlock.c    Sat Jul 04 15:09:49 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dotlock.c,v 1.11 2009/10/21 01:07:46 snj Exp $ */
+/*     $NetBSD: dotlock.c,v 1.12 2015/07/04 15:09:49 christos Exp $    */
 
 /*
  * Copyright (c) 1996 Christos Zoulas.  All rights reserved.
@@ -26,7 +26,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: dotlock.c,v 1.11 2009/10/21 01:07:46 snj Exp $");
+__RCSID("$NetBSD: dotlock.c,v 1.12 2015/07/04 15:09:49 christos Exp $");
 #endif
 
 #include "rcv.h"
@@ -80,13 +80,13 @@
        /*
         * We try to create the unique filename.
         */
-       for (ntries = 0; ntries < 5; ntries++) {
+       for (ntries = 0; ; ntries++) {
                fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_SYNC, 0);
                if (fd != -1) {
                        (void)close(fd);
                        break;
                }
-               else if (errno == EEXIST)
+               else if (errno == EEXIST || ntries < 5)
                        continue;
                else
                        return -1;



Home | Main Index | Thread Index | Old Index