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.
This commit is contained in:
Samuel Thibault 2022-05-05 02:14:43 +02:00
parent c1b68685d4
commit eff158b75d
1 changed files with 1 additions and 1 deletions

View File

@ -154,7 +154,7 @@ __spawni (pid_t *pid, const char *file,
reauthenticated, or was newly opened on behalf of the child. */ reauthenticated, or was newly opened on behalf of the child. */
error_t reauthenticate_fd (int fd) error_t reauthenticate_fd (int fd)
{ {
if (dtable_cells[fd] != NULL) if (dtable_cells[fd] != NULL && dtable[fd] != MACH_PORT_NULL)
{ {
file_t newfile; file_t newfile;
mach_port_t ref = __mach_reply_port (); mach_port_t ref = __mach_reply_port ();