diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-06-20 04:17:43 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-06-20 04:17:43 +0000 |
commit | c09602741c12c3a2b716d8adb35fb0ad6e594d24 (patch) | |
tree | 1544597781bd0bbd40fde13290a16cca1980967f | |
parent | 2ed0c6aa0e1c6c6ea85978958593e7a4dcd877bb (diff) |
Use mkdtemp(3)
-rw-r--r-- | usr.bin/mktemp/mktemp.c | 16 |
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 |