From 8592f0d8e4efd3cbadbfa2ad35c105156ef1e33b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 21 Aug 2022 11:37:07 +0100 Subject: [PATCH] prefork-interp: properly unlock lock in setup child Signed-off-by: Ian Jackson --- cprogs/prefork-interp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cprogs/prefork-interp.c b/cprogs/prefork-interp.c index fb45ca0..d87e8f8 100644 --- a/cprogs/prefork-interp.c +++ b/cprogs/prefork-interp.c @@ -697,8 +697,9 @@ void become_watcher(void) { } static __attribute__((noreturn)) -void become_setup(int sfd, int fake_pair[2], +void become_setup(int sfd, int lockfd, int fake_pair[2], int watcher_stdin, int watcher_stderr) { + close(lockfd); close(fake_pair[0]); int call_fd = fake_pair[1]; @@ -792,7 +793,7 @@ static void connect_or_spawn(void) { pid_t setup_pid = fork(); if (setup_pid == (pid_t)-1) diee("fork for spawn setup"); - if (!setup_pid) become_setup(sfd, fake_pair, + if (!setup_pid) become_setup(sfd, lockfd, fake_pair, watcher_stdin[1], watcher_stderr[0]); close(fake_pair[1]); close(sfd); -- 2.30.2