From f684386ad432bb8379442a034bdd389b8e1e9640 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 10 Jan 2011 21:00:51 +0000 Subject: Back out rev 1.2 and use mkstemp(), not mktemp(). OK deraadt@ --- libexec/mail.local/locking.c | 6 ++++-- 1 file 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 @@ -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 -- cgit v1.2.3