From 3b17fe15f0b87ed2cca91a692c60bc28ac7dd0df Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Mon, 26 Jan 2015 21:28:48 +0800 Subject: [PATCH] Bug fix #263: Always redirect std{out,err} if --logpath is specified 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. (#263) --- src/compton.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compton.c b/src/compton.c index 37e93c23..d8efda1f 100644 --- a/src/compton.c +++ b/src/compton.c @@ -4965,7 +4965,6 @@ fork_after(session_t *ps) { printf_errf("(): freopen() failed."); return false; } - success = ostream_reopen(ps, NULL); return success; } @@ -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