From 95a00ba347e6d5b0a857e325acedfc49a22d2fba Mon Sep 17 00:00:00 2001 From: Logan Capaldo Date: Mon, 20 Oct 2025 15:46:50 -0400 Subject: [PATCH] Make the write end of the master CLOEXEC. Otherwise handler process children can keep the monitor process alive after the monitored process has exited. --- src/bcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bcd.c b/src/bcd.c index 38f2a0a..fe1d755 100644 --- a/src/bcd.c +++ b/src/bcd.c @@ -1965,6 +1965,7 @@ bcd_init(const struct bcd_config *cf, bcd_error_t *error) sb->monitor_pid = child; bcd_pipe_ensure_readonly(&sb->monitor); bcd_pipe_ensure_writeonly(&sb->master); + fcntl(sb->master.fd[1], F_SETFD, FD_CLOEXEC); // Make sure children don't keep the monitor process around /* * After the child has spawned, wait for configuration information.