1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

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.
This commit is contained in:
Bruce Evans 1996-11-18 16:56:51 +00:00
parent f8b04ff4fc
commit 1ad652a54c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19850

View File

@ -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