[mktemp.c]
     Remove useless code, the kernel will set errno appropriately if an
     element in the path does not exist.  OK deraadt@ pvalchev@
This commit is contained in:
Damien Miller 2011-09-23 10:47:29 +10:00
parent dc0e09b41c
commit 3a359b3228
2 changed files with 5 additions and 21 deletions

View File

@ -17,6 +17,10 @@
- deraadt@cvs.openbsd.org 2008/07/22 21:47:45 - deraadt@cvs.openbsd.org 2008/07/22 21:47:45
[mktemp.c] [mktemp.c]
use arc4random_uniform(); ok djm millert use arc4random_uniform(); ok djm millert
- millert@cvs.openbsd.org 2008/08/21 16:54:44
[mktemp.c]
Remove useless code, the kernel will set errno appropriately if an
element in the path does not exist. OK deraadt@ pvalchev@
20110922 20110922
- OpenBSD CVS Sync - OpenBSD CVS Sync

View File

@ -1,7 +1,7 @@
/* THIS FILE HAS BEEN MODIFIED FROM THE ORIGINAL OPENBSD SOURCE */ /* THIS FILE HAS BEEN MODIFIED FROM THE ORIGINAL OPENBSD SOURCE */
/* Changes: Removed mktemp */ /* Changes: Removed mktemp */
/* $OpenBSD: mktemp.c,v 1.21 2008/07/22 21:47:45 deraadt Exp $ */ /* $OpenBSD: mktemp.c,v 1.22 2008/08/21 16:54:44 millert Exp $ */
/* /*
* Copyright (c) 1987, 1993 * Copyright (c) 1987, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@ -112,26 +112,6 @@ _gettemp(path, doopen, domkdir, slen)
} }
start = trv + 1; start = trv + 1;
/* Check the target directory. */
if (doopen || domkdir) {
for (;; --trv) {
if (trv <= path)
break;
if (*trv == '/') {
*trv = '\0';
rval = stat(path, &sbuf);
*trv = '/';
if (rval != 0)
return(0);
if (!S_ISDIR(sbuf.st_mode)) {
errno = ENOTDIR;
return(0);
}
break;
}
}
}
for (;;) { for (;;) {
if (doopen) { if (doopen) {
if ((*doopen = if ((*doopen =