Fixed execvp() of an empty pathname to fail POSIXly. Previously it

attempted to exec the components of $PATH and it usually set errno
to the wrong value.

Found by:	NIST PCTS
This commit is contained in:
bde 1996-11-18 19:24:47 +00:00
parent 93424e6cf9
commit 998611f369

View File

@ -200,6 +200,12 @@ execvp(name, argv)
}
bp = buf;
/* If it's an empty path name, fail in the usual POSIX way. */
if (*name == '\0') {
errno = ENOENT;
return (-1);
}
/* Get the path we're searching. */
if (!(path = getenv("PATH")))
path = _PATH_DEFPATH;