diff options
author | bde <bde@FreeBSD.org> | 1996-11-18 16:56:51 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-11-18 16:56:51 +0000 |
commit | 93424e6cf9a785301316691ee285cf3d721e80e4 (patch) | |
tree | 491f69b54517d79509a8acfc7c10ecb0c616a0ff /lib/libc/gen/exec.c | |
parent | 8bb5970b82c107b742b6104f8c5913c25cfd1228 (diff) | |
download | FreeBSD-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.c | 3 |
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 |