summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2011-01-10 21:00:51 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2011-01-10 21:00:51 +0000
commitf684386ad432bb8379442a034bdd389b8e1e9640 (patch)
tree44d7079271ab63823a9516e41278a86456538c4c /libexec
parent579bf3acdf41bffca91b45450743135061f19d88 (diff)
Back out rev 1.2 and use mkstemp(), not mktemp(). OK deraadt@
Diffstat (limited to 'libexec')
-rw-r--r--libexec/mail.local/locking.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libexec/mail.local/locking.c b/libexec/mail.local/locking.c
index 441edd5bd89..735c846e4eb 100644
--- a/libexec/mail.local/locking.c
+++ b/libexec/mail.local/locking.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: locking.c,v 1.9 2009/10/27 23:59:31 deraadt Exp $ */
+/* $OpenBSD: locking.c,v 1.10 2011/01/10 21:00:50 millert Exp $ */
/*
* Copyright (c) 1996-1998 Theo de Raadt <deraadt@theos.com>
@@ -141,12 +141,14 @@ void
baditem(char *path)
{
char npath[MAXPATHLEN];
+ int fd;
if (unlink(path) == 0)
return;
snprintf(npath, sizeof npath, "%s/mailXXXXXXXXXX", _PATH_MAILDIR);
- if (mktemp(npath) == NULL)
+ if ((fd = mkstemp(npath)) == -1)
return;
+ close(fd);
if (rename(path, npath) == -1)
unlink(npath);
else