From: Roy Marples Date: Tue, 22 Aug 2023 12:59:23 +0000 (+0000) Subject: privsep: Fix a FD leak when processes exit X-Git-Tag: v10.0.3~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e30adeb939334ef0351fb69691181fe1838904ec;p=thirdparty%2Fdhcpcd.git privsep: Fix a FD leak when processes exit Add commentary to say they are closed on receipt of SIGCHLD. --- diff --git a/src/privsep.c b/src/privsep.c index cfe54742..ecc517ec 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -412,7 +412,6 @@ ps_startprocess(struct ps_process *psp, return pid; } - #ifdef PLUGIN_DEV /* If we are not the root process, stop listening to devices. */ if (ctx->ps_root != psp) @@ -541,11 +540,11 @@ ps_stopprocess(struct ps_process *psp) err = -1; } #endif - psp->psp_fd = -1; } /* Don't wait for the process as it may not respond to the shutdown - * request. We'll reap the process on receipt of SIGCHLD. */ + * request. We'll reap the process on receipt of SIGCHLD where we + * also close the fd. */ return err; }