[PATCH 3/3] Linux: Port fexecve to <fd_to_filename.h>

Florian Weimer fweimer@redhat.com
Fri Feb 14 18:11:00 GMT 2020


---
 sysdeps/unix/sysv/linux/fexecve.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/fexecve.c b/sysdeps/unix/sysv/linux/fexecve.c
index 23c9799f5d..d8cf924faf 100644
--- a/sysdeps/unix/sysv/linux/fexecve.c
+++ b/sysdeps/unix/sysv/linux/fexecve.c
@@ -25,6 +25,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 #include <kernel-features.h>
+#include <fd_to_filename.h>
 
 
 /* Execute the file FD refers to, overlaying the running program image.
@@ -50,11 +51,10 @@ 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);
+  struct fd_to_filename storage;
 
   /* We do not need the return value.  */
-  __execve (buf, argv, envp);
+  __execve (__fd_to_filename (fd, &storage), argv, envp);
 
   int save = errno;
 
-- 
2.24.1



More information about the Libc-alpha mailing list