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

Message ID ecf74ed0429118ab5b24b3048491dc2a7e7de0de.1581703185.git.fweimer@redhat.com
State Superseded
Headers

Commit Message

Florian Weimer Feb. 14, 2020, 6:11 p.m. UTC
  ---
 sysdeps/unix/sysv/linux/fexecve.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Patch

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;