diff options
author | dm <dm@cvs.openbsd.org> | 1996-08-27 20:33:42 +0000 |
---|---|---|
committer | dm <dm@cvs.openbsd.org> | 1996-08-27 20:33:42 +0000 |
commit | 3c80147eae7e6334441f3c0317fe619e547bdb77 (patch) | |
tree | 68742ba30dbf46a0b4c640fef4f61460dcb4988c | |
parent | 52fb14d5926d190912a7cd6c14785ca23b9cee5d (diff) |
Fix race condition.
-rw-r--r-- | libexec/mail.local/mail.local.c | 4 |
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 */ |