execvp() also needs to verify that an entry it found in the path is a

file. It would try to execute directories before (#1963).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24599 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-03-26 23:43:35 +00:00
parent 5226ccb689
commit 6638711aa9
1 changed files with 5 additions and 0 deletions

View File

@ -164,6 +164,11 @@ execvp(const char *file, char* const* argv)
strcat(path, "/");
strcat(path, file);
// check whether it is a file
struct stat st;
if (stat(path, &st) != 0 || !S_ISREG(st.st_mode))
continue;
// if executable, execute it
if (access(path, X_OK) == 0)
return do_exec(path, argv, environ, true);