From 31f6a4a6a004f62726a66a1b089b1a5612f168ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 2 Nov 2020 19:12:12 +0100 Subject: [PATCH] =?UTF-8?q?module/script:=20don=E2=80=99t=20re-close=20com?= =?UTF-8?q?m-pipe=20on=20failure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/script.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/script.c b/modules/script.c index ed41bfd..da11a80 100644 --- a/modules/script.c +++ b/modules/script.c @@ -475,14 +475,17 @@ run(struct module *mod) goto fail; } + /* We're done with the redirection pipe */ close(comm_pipe[1]); + comm_pipe[1] = -1; execvp(m->path, argv); fail: (void)!write(exec_pipe[1], &errno, sizeof(errno)); close(exec_pipe[1]); - close(comm_pipe[1]); + if (comm_pipe[1] >= 0) + close(comm_pipe[1]); _exit(errno); }