unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: libc-alpha@sourceware.org
Cc: commit-hurd@gnu.org
Subject: [hurd,commited] hurd: Fix fexecve
Date: Fri, 29 May 2020 01:32:17 +0200	[thread overview]
Message-ID: <20200528233217.1430223-1-samuel.thibault@ens-lyon.org> (raw)

* sysdeps/mach/hurd/fexecve.c (fexecve): Re-lookup fd with O_EXEC before
calling _hurd_exec_paths.
---
 sysdeps/mach/hurd/fexecve.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/sysdeps/mach/hurd/fexecve.c b/sysdeps/mach/hurd/fexecve.c
index 2b24e46fbf..c6a00ebf1e 100644
--- a/sysdeps/mach/hurd/fexecve.c
+++ b/sysdeps/mach/hurd/fexecve.c
@@ -25,10 +25,23 @@
 int
 fexecve (int fd, char *const argv[], char *const envp[])
 {
-  error_t err = HURD_DPORT_USE (fd, _hurd_exec_paths (__mach_task_self (),
-						      port, NULL, NULL,
-						      argv, envp));
+  file_t file;
+  error_t err;
+  enum retry_type doretry;
+  char retryname[1024];
+
+  err = HURD_DPORT_USE (fd,
+      __dir_lookup (port, "", O_EXEC, 0, &doretry, retryname, &file));
+
+  if (! err && (doretry != FS_RETRY_NORMAL || retryname[0] != '\0'))
+    err = EGRATUITOUS;
+  if (err)
+    return __hurd_fail(err);
+
+  err = _hurd_exec_paths (__mach_task_self (), file, NULL, NULL, argv, envp);
   if (! err)
     err = EGRATUITOUS;
+
+  __mach_port_deallocate (__mach_task_self (), file);
   return __hurd_fail (err);
 }
-- 
2.26.2


                 reply	other threads:[~2020-05-28 23:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200528233217.1430223-1-samuel.thibault@ens-lyon.org \
    --to=samuel.thibault@ens-lyon.org \
    --cc=commit-hurd@gnu.org \
    --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).