summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-06-20 04:17:43 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-06-20 04:17:43 +0000
commitc09602741c12c3a2b716d8adb35fb0ad6e594d24 (patch)
tree1544597781bd0bbd40fde13290a16cca1980967f
parent2ed0c6aa0e1c6c6ea85978958593e7a4dcd877bb (diff)
Use mkdtemp(3)
-rw-r--r--usr.bin/mktemp/mktemp.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/usr.bin/mktemp/mktemp.c b/usr.bin/mktemp/mktemp.c
index 1d89955fb56..2ceac69fb6a 100644
--- a/usr.bin/mktemp/mktemp.c
+++ b/usr.bin/mktemp/mktemp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mktemp.c,v 1.3 1997/06/17 15:34:29 millert Exp $ */
+/* $OpenBSD: mktemp.c,v 1.4 1997/06/20 04:17:42 millert Exp $ */
/*
* Copyright (c) 1996 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: mktemp.c,v 1.3 1997/06/17 15:34:29 millert Exp $";
+static char rcsid[] = "$OpenBSD: mktemp.c,v 1.4 1997/06/20 04:17:42 millert Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -85,17 +85,7 @@ main(argc, argv)
}
if (makedir) {
- for (c = 0; c < 100; c++) {
- if (mktemp(template) == NULL)
- if (qflag)
- exit(1);
- else
- err(1, "Cannot create temp dir %s",
- template);
- if (mkdir(template, 0700) == 0)
- break;
- }
- if (c >= 100) {
+ if (mkdtemp(template) == NULL) {
if (qflag)
exit(1);
else