Skip to content

Commit

Permalink
Bug fix chjj#263: Always redirect std{out,err} if --logpath is specified
Browse files Browse the repository at this point in the history
Always redirect std{out,err} if --logpath is specified, instead of only
redirect after fork, to correct the inconsistent behavior of --logpath
when getppid() returns 1. (chjj#263)
  • Loading branch information
richardgv committed Jan 26, 2015
1 parent 64b4fe2 commit 3b17fe1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -4965,7 +4965,6 @@ fork_after(session_t *ps) {
printf_errf("(): freopen() failed.");
return false;
}
success = ostream_reopen(ps, NULL);

return success;
}
Expand Down Expand Up @@ -7444,6 +7443,10 @@ session_init(session_t *ps_old, int argc, char **argv) {
}
}

// Redirect output stream
if (ps->o.fork_after_register || ps->o.logpath)
ostream_reopen(ps, NULL);

write_pid(ps);

// Free the old session
Expand Down

0 comments on commit 3b17fe1

Please sign in to comment.