This commit is contained in:
Daniel Gollub 2026-05-27 19:39:58 +08:00 committed by GitHub
commit 07900b0a21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -261,6 +261,21 @@ close_fds_except(int keep)
close(i);
}
}
#if defined(HAVE_DUP) && defined(HAVE_DUP2)
int fd;
if ((fd = open ("/dev/null", O_RDWR, 0)) != -1)
{
dup2 (fd, 0);
dup2 (fd, 1);
dup2 (fd, 2);
if (fd > 2)
{
close (fd);
}
}
#endif
}
/*