From: Ian Jackson Date: Sun, 21 Aug 2022 10:37:07 +0000 (+0100) Subject: prefork-interp: properly unlock lock in setup child X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=8592f0d8e4efd3cbadbfa2ad35c105156ef1e33b;p=chiark-utils.git prefork-interp: properly unlock lock in setup child Signed-off-by: Ian Jackson --- 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);