diff options
author | Érico Nogueira <ericonr@disroot.org> | 2021-04-27 10:09:45 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-05-03 16:46:10 -0300 |
commit | 77c1573dbceebf75203e4201615def9765599d87 (patch) | |
tree | d9a5545b804fee221c00125372d278efe1f9521d /sysdeps/unix/sysv/linux/fexecve.c | |
parent | 19d83270fcd993cc349570164e21b06d57036704 (diff) | |
download | glibc-77c1573dbceebf75203e4201615def9765599d87.zip glibc-77c1573dbceebf75203e4201615def9765599d87.tar.gz glibc-77c1573dbceebf75203e4201615def9765599d87.tar.bz2 |
linux: use __fd_to_filename helper function instead of snprintf.
Change made to fchmodat and fexecve. There are tests using xasprintf
instead of this helper as well, but this commit doesn't touch them.
Diffstat (limited to 'sysdeps/unix/sysv/linux/fexecve.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/fexecve.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/fexecve.c b/sysdeps/unix/sysv/linux/fexecve.c index f37c245..df25c2a 100644 --- a/sysdeps/unix/sysv/linux/fexecve.c +++ b/sysdeps/unix/sysv/linux/fexecve.c @@ -22,6 +22,7 @@ #include <fcntl.h> #include <sys/stat.h> +#include <fd_to_filename.h> #include <sysdep.h> #include <sys/syscall.h> #include <kernel-features.h> @@ -49,12 +50,9 @@ fexecve (int fd, char *const argv[], char *const envp[]) #ifndef __ASSUME_EXECVEAT /* We use the /proc filesystem to get the information. If it is not - mounted we fail. */ - char buf[sizeof "/proc/self/fd/" + sizeof (int) * 3]; - __snprintf (buf, sizeof (buf), "/proc/self/fd/%d", fd); - - /* We do not need the return value. */ - __execve (buf, argv, envp); + mounted we fail. We do not need the return value. */ + struct fd_to_filename filename; + __execve (__fd_to_filename (fd, &filename), argv, envp); int save = errno; |