module/script: don’t re-direct stderr to /dev/null

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

View file

@ -463,13 +463,12 @@ run(struct module *mod)
close(exec_pipe[0]); close(exec_pipe[0]);
close(comm_pipe[0]); close(comm_pipe[0]);
/* Re-direct stdin/stdout/stderr */ /* Re-direct stdin/stdout */
int dev_null = open("/dev/null", O_RDWR); int dev_null = open("/dev/null", O_RDONLY);
if (dev_null < 0) if (dev_null < 0)
goto fail; goto fail;
if (dup2(dev_null, STDIN_FILENO) < 0 || if (dup2(dev_null, STDIN_FILENO) < 0 ||
dup2(dev_null, STDERR_FILENO) < 0 ||
dup2(comm_pipe[1], STDOUT_FILENO) < 0) dup2(comm_pipe[1], STDOUT_FILENO) < 0)
{ {
goto fail; goto fail;