Module Name:    src
Committed By:   christos
Date:           Sat Jul  4 15:09:49 UTC 2015

Modified Files:
        src/usr.bin/mail: dotlock.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mail/dotlock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/dotlock.c
diff -u src/usr.bin/mail/dotlock.c:1.11 src/usr.bin/mail/dotlock.c:1.12
--- src/usr.bin/mail/dotlock.c:1.11	Tue Oct 20 21:07:46 2009
+++ src/usr.bin/mail/dotlock.c	Sat Jul  4 11:09:49 2015
@@ -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 @@ create_exclusive(const char *fname)
 	/*
 	 * 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;

Reply via email to