debloat code that depends on /proc/self/fd/%d with shared function
[musl] / src / process / fexecve.c
1 #include <unistd.h>
2 #include <stdio.h>
3 #include <errno.h>
4
5 void __procfdname(char *, unsigned);
6
7 int fexecve(int fd, char *const argv[], char *const envp[])
8 {
9         char buf[15 + 3*sizeof(int)];
10         __procfdname(buf, fd);
11         execve(buf, argv, envp);
12         if (errno == ENOENT) errno = EBADF;
13         return -1;
14 }