This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 3/3] Linux: Port fexecve to <fd_to_filename.h>
- From: Florian Weimer <fweimer at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 14 Feb 2020 19:11:20 +0100
- Subject: [PATCH 3/3] Linux: Port fexecve to <fd_to_filename.h>
- References: <cover.1581703185.git.fweimer@redhat.com>
---
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