From 4b87736998e8d8c0610c3c31b6862c77248a98df Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 29 Sep 2011 00:48:04 -0400 Subject: fix various bugs in path and error handling in execvp/fexecve --- src/process/fexecve.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/process/fexecve.c') diff --git a/src/process/fexecve.c b/src/process/fexecve.c index 3098645d..5939181a 100644 --- a/src/process/fexecve.c +++ b/src/process/fexecve.c @@ -1,10 +1,13 @@ #include #include +#include int fexecve(int fd, char *const argv[], char *const envp[]) { static const char proc[] = "/proc/self/fd/%d"; char buf[sizeof proc + 3*sizeof(int)]; snprintf(buf, sizeof buf, proc, fd); - return execve(buf, argv, envp); + execve(buf, argv, envp); + if (errno == ENOENT) errno = EBADF; + return -1; } -- cgit v1.2.1