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:
@@ -164,6 +164,11 @@ execvp(const char *file, char* const* argv)
|
|||||||
strcat(path, "/");
|
strcat(path, "/");
|
||||||
strcat(path, file);
|
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 executable, execute it
|
||||||
if (access(path, X_OK) == 0)
|
if (access(path, X_OK) == 0)
|
||||||
return do_exec(path, argv, environ, true);
|
return do_exec(path, argv, environ, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user