summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordm <dm@openbsd.org>1996-08-27 20:33:41 +0000
committerdm <dm@openbsd.org>1996-08-27 20:33:41 +0000
commita8085b99cccf812c3bc37a463b8a656ef068e83c (patch)
treef1920978fbb7dd487971e986da89a481749f6066
parentNew fast pipe(2) from freebsd without fancy vm stuff. (diff)
downloadwireguard-openbsd-a8085b99cccf812c3bc37a463b8a656ef068e83c.tar.xz
wireguard-openbsd-a8085b99cccf812c3bc37a463b8a656ef068e83c.zip
Fix race condition.
-rw-r--r--libexec/mail.local/mail.local.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libexec/mail.local/mail.local.c b/libexec/mail.local/mail.local.c
index 747df1cb1b6..ff8f797f817 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.3 1996/08/27 03:18:00 dm Exp $";
+static char rcsid[] = "$Id: mail.local.c,v 1.4 1996/08/27 20:33:41 dm Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -207,7 +207,7 @@ retry:
err(NOTFATAL, "%s: %s", path, strerror(errno));
goto bad;
}
- if ((mbfd = open(path, O_APPEND|O_CREAT|O_WRONLY|O_EXLOCK,
+ if ((mbfd = open(path, O_APPEND|O_CREAT|O_EXCL|O_WRONLY|O_EXLOCK,
S_IRUSR|S_IWUSR)) < 0) {
if (errno == EEXIST) {
/* file appeared since lstat */