unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 3/3] Linux: Port fexecve to <fd_to_filename.h>
Date: Fri, 14 Feb 2020 19:11:20 +0100	[thread overview]
Message-ID: <ecf74ed0429118ab5b24b3048491dc2a7e7de0de.1581703185.git.fweimer@redhat.com> (raw)
In-Reply-To: <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


      parent reply	other threads:[~2020-02-14 18:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 18:10 [PATCH 0/3] <fd_to_filename.h> improvements Florian Weimer
2020-02-14 18:11 ` [PATCH 1/3] <fd_to_filename.h>: Add type safety and port to Hurd Florian Weimer
2020-02-14 18:43   ` Samuel Thibault
2020-02-14 19:08   ` Adhemerval Zanella
2020-02-14 20:21     ` Florian Weimer
2020-02-14 20:28   ` Paul Eggert
2020-02-15 13:16     ` Florian Weimer
2020-02-16  0:02       ` Paul Eggert
2020-02-17 15:18         ` Florian Weimer
2020-02-17 18:26           ` Paul Eggert
2020-02-17 18:59             ` Adhemerval Zanella
2020-02-17 19:14               ` Paul Eggert
2020-02-14 18:11 ` [PATCH 2/3] Linux: Port ttyname, ttyname_r to <fd_file_name.h> Florian Weimer
2020-02-14 18:11 ` Florian Weimer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecf74ed0429118ab5b24b3048491dc2a7e7de0de.1581703185.git.fweimer@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).