diff options
author | bkurtz <github+adelielinux@benkurtz.org> | 2022-10-09 05:02:17 -0700 |
---|---|---|
committer | bkurtz <github+adelielinux@benkurtz.org> | 2022-10-09 05:10:59 -0700 |
commit | 4a4c840b9a02ea24414fc8682f87f583bbaee9cc (patch) | |
tree | 313ea45c564a5fc23b14a511412ac358fabf83b3 /libgcompat | |
parent | 9dbbddcb9813b84b48057a1756eacede6e48cdc7 (diff) | |
download | gcompat-4a4c840b9a02ea24414fc8682f87f583bbaee9cc.tar.gz gcompat-4a4c840b9a02ea24414fc8682f87f583bbaee9cc.tar.bz2 gcompat-4a4c840b9a02ea24414fc8682f87f583bbaee9cc.tar.xz gcompat-4a4c840b9a02ea24414fc8682f87f583bbaee9cc.zip |
fix path-searching for execvp
Diffstat (limited to 'libgcompat')
-rw-r--r-- | libgcompat/unistd.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libgcompat/unistd.c b/libgcompat/unistd.c index 7e9227d..011fba2 100644 --- a/libgcompat/unistd.c +++ b/libgcompat/unistd.c @@ -231,8 +231,19 @@ int execv(const char *pathname, char *const argv[]) { return execve(pathname, argv, environ); } +static int (*real_execvp)(const char *file, char *const argv[]); int execvp(const char *file, char *const argv[]) { - return execv(file, argv); + if(!strcmp(file, "/proc/self/exe")) { + return execv(file, argv); + } + if(real_execvp == NULL) { + real_execvp = dlsym(RTLD_NEXT, "execvp"); + if(real_execvp == NULL) { + errno = ENOSYS; + return -1; + } + } + return real_execvp(file, argv); } int __close(int fd) |