about summary refs log tree commit diff
path: root/sysdeps/mach/hurd
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-05-05 02:14:43 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-05-05 02:14:43 +0200
commiteff158b75dee466ac0c37a17b2165072ee0b7aeb (patch)
treee61ace6dbbca978ddcf75f8f043740eac6b90a67 /sysdeps/mach/hurd
parentc1b68685d438373efe64e5f076f4215723004dfb (diff)
downloadglibc-eff158b75dee466ac0c37a17b2165072ee0b7aeb.tar.gz
glibc-eff158b75dee466ac0c37a17b2165072ee0b7aeb.tar.xz
glibc-eff158b75dee466ac0c37a17b2165072ee0b7aeb.zip
hurd spawni: Fix reauthenticating closed fds
When an fd is closed, the port cell remains, but the port becomes
MACH_PORT_NULL, so we have to guard against it.
Diffstat (limited to 'sysdeps/mach/hurd')
-rw-r--r--sysdeps/mach/hurd/spawni.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c
index f19b688411..ffc62e660e 100644
--- a/sysdeps/mach/hurd/spawni.c
+++ b/sysdeps/mach/hurd/spawni.c
@@ -154,7 +154,7 @@ __spawni (pid_t *pid, const char *file,
      reauthenticated, or was newly opened on behalf of the child.  */
   error_t reauthenticate_fd (int fd)
     {
-      if (dtable_cells[fd] != NULL)
+      if (dtable_cells[fd] != NULL && dtable[fd] != MACH_PORT_NULL)
 	{
 	  file_t newfile;
 	  mach_port_t ref = __mach_reply_port ();