提交 8e0b3806 编写于 作者: P Przemyslaw Pawelczyk 提交者: Rich Felker

fix execvp failing on not-dir entries in PATH.

It's better to make execvp continue PATH search on ENOTDIR rather than
issuing an error. Bogus entries should not render rest of PATH invalid.

Maintainer's note: POSIX seems to require the search to continue like
this as part of XBD 8.3 Other Environment Variables. Only errors that
conclusively determine non-existence are candidates for continuing;
otherwise for consistency we have to report the error.
上级 75cba9c6
......@@ -40,7 +40,7 @@ int __execvpe(const char *file, char *const argv[], char *const envp[])
memcpy(b+(z-p)+(z>p), file, k+1);
execve(b, argv, envp);
if (errno == EACCES) seen_eacces = 1;
else if (errno != ENOENT) return -1;
else if (errno != ENOENT && errno != ENOTDIR) return -1;
if (!*z++) break;
}
if (seen_eacces) errno = EACCES;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册