Skip to content

Commit

Permalink
Merge pull request #112 from giuseppe/chmod-pipes
Browse files Browse the repository at this point in the history
conmon: chmod std files pipes
  • Loading branch information
rhatdan authored Jan 7, 2020
2 parents 6e39a83 + b0c3ea0 commit 26f6817
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/conmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1547,16 +1547,22 @@ int main(int argc, char *argv[])
slavefd_stdin = dev_null_r;
if (dup2(slavefd_stdin, STDIN_FILENO) < 0)
pexit("Failed to dup over stdin");
if (fchmod(STDIN_FILENO, 0777) < 0)
nwarn("Failed to chown stdin");

if (slavefd_stdout < 0)
slavefd_stdout = dev_null_w;
if (dup2(slavefd_stdout, STDOUT_FILENO) < 0)
pexit("Failed to dup over stdout");
if (fchmod(STDOUT_FILENO, 0777) < 0)
nwarn("Failed to chown stdout");

if (slavefd_stderr < 0)
slavefd_stderr = slavefd_stdout;
if (dup2(slavefd_stderr, STDERR_FILENO) < 0)
pexit("Failed to dup over stderr");
if (fchmod(STDERR_FILENO, 0777) < 0)
nwarn("Failed to chown stderr");

/* If LISTEN_PID env is set, we need to set the LISTEN_PID
it to the new child process */
Expand Down

0 comments on commit 26f6817

Please sign in to comment.