]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Fix a FD leak when processes exit
authorRoy Marples <roy@marples.name>
Tue, 22 Aug 2023 12:59:23 +0000 (12:59 +0000)
committerRoy Marples <roy@marples.name>
Tue, 22 Aug 2023 12:59:23 +0000 (12:59 +0000)
Add commentary to say they are closed on receipt of SIGCHLD.

src/privsep.c

index cfe54742f5af3b3acc8b70ac063a528be8496ca3..ecc517ec38bf41207c66cff91a8d94b13f43a5fa 100644 (file)
@@ -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;
 }