module/script: don’t re-close comm-pipe on failure

This commit is contained in:
Daniel Eklöf 2020-11-02 19:12:12 +01:00
parent c11a79c98d
commit 31f6a4a6a0
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -475,13 +475,16 @@ run(struct module *mod)
goto fail; goto fail;
} }
/* We're done with the redirection pipe */
close(comm_pipe[1]); close(comm_pipe[1]);
comm_pipe[1] = -1;
execvp(m->path, argv); execvp(m->path, argv);
fail: fail:
(void)!write(exec_pipe[1], &errno, sizeof(errno)); (void)!write(exec_pipe[1], &errno, sizeof(errno));
close(exec_pipe[1]); close(exec_pipe[1]);
if (comm_pipe[1] >= 0)
close(comm_pipe[1]); close(comm_pipe[1]);
_exit(errno); _exit(errno);
} }