Option stderr leaked a temporary FD into child process

This commit is contained in:
Gerhard Rieger 2023-06-12 12:25:54 +02:00
parent 80f4aa8bcd
commit b3dde9a009
2 changed files with 4 additions and 0 deletions

View file

@ -37,6 +37,9 @@ Corrections:
The FDs of the socketpair that queues messages from signal handlers
lacked FD_CLOEXEC and thus leaked into EXEC and SYSTEM child processes.
Option stderr on addresses EXEC and SYSTEM uses a temporary FD. It
lacked the FD_CLOEXEC setting and thus leakt into child processes.
Features:
VSOCK, VSOCK-L support options pf, socktype, prototype (currently
useless)

View file

@ -472,6 +472,7 @@ int diag_dup(void) {
return -1;
}
newfd = dup(fileno(diagopts.logfile));
Fcntl_l(newfd, F_SETFD, FD_CLOEXEC);
if (diagopts.logfile != stderr) {
fclose(diagopts.logfile);
}