From 766631018fb28b0bceac3fb57712fffd8a61c42f Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Mon, 18 Nov 1996 19:24:47 +0000 Subject: 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 --- lib/libc/gen/exec.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/libc/gen/exec.c') diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c index 2410ce974492..72b6db43b1da 100644 --- a/lib/libc/gen/exec.c +++ b/lib/libc/gen/exec.c @@ -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; -- cgit v1.2.3