summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/exec.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1996-11-18 16:56:51 +0000
committerbde <bde@FreeBSD.org>1996-11-18 16:56:51 +0000
commit93424e6cf9a785301316691ee285cf3d721e80e4 (patch)
tree491f69b54517d79509a8acfc7c10ecb0c616a0ff /lib/libc/gen/exec.c
parent8bb5970b82c107b742b6104f8c5913c25cfd1228 (diff)
downloadFreeBSD-src-93424e6cf9a785301316691ee285cf3d721e80e4.zip
FreeBSD-src-93424e6cf9a785301316691ee285cf3d721e80e4.tar.gz
Fixed uninitialized variables for the '/'-in-pathname case in execvp().
Garbage in `eacces' caused the wrong errno to be set for non-EACCES errors. Garbage in `etxtbsy' caused a semi-random retry strategy for ETXTBSY errors. Found by: NIST-PCTS. gcc -Wall reported the problem, but -Wall is not enabled for libc.
Diffstat (limited to 'lib/libc/gen/exec.c')
-rw-r--r--lib/libc/gen/exec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c
index b62ae63..2410ce9 100644
--- a/lib/libc/gen/exec.c
+++ b/lib/libc/gen/exec.c
@@ -190,6 +190,8 @@ execvp(name, argv)
int eacces, etxtbsy;
char *bp, *cur, *path, buf[MAXPATHLEN];
+ eacces = etxtbsy = 0;
+
/* If it's an absolute or relative path name, it's easy. */
if (index(name, '/')) {
bp = (char *)name;
@@ -203,7 +205,6 @@ execvp(name, argv)
path = _PATH_DEFPATH;
cur = path = strdup(path);
- eacces = etxtbsy = 0;
while ( (p = strsep(&cur, ":")) ) {
/*
* It's a SHELL path -- double, leading and trailing colons
OpenPOWER on IntegriCloud