LINUX.ORG.RU

execlp, почему оно работает


0

1
execlp("/usr/local/bin/app", "app", "args", NULL);

Если я правильно понял, то:

The execlp(), execvp(), and execvpe() functions duplicate the actions of the shell in searching for an executable file if the specified filename does not contain a slash (/) character. The file is sought in the colon-separated list of directory pathnames specified in the PATH environment variable. If this variable isn't defined, the path list defaults to the current directory followed by the list of directories returned by confstr(_CS_PATH). (This confstr(3) call typically returns the value «/bin:/usr/bin».)

If the specified filename includes a slash character, then PATH is ignored, and the file at the specified pathname is executed.

Но app по факту лежит в /usr/bin. Почему работает?

★★★★★

If permission is denied for a file (the attempted execve(2) failed with the error EACCES), these functions will continue searching the rest of the search path.

UVV ★★★★★
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.