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)
This commit is contained in:
parent
64b4fe2c72
commit
3b17fe15f0
|
@ -4965,7 +4965,6 @@ fork_after(session_t *ps) {
|
||||||
printf_errf("(): freopen() failed.");
|
printf_errf("(): freopen() failed.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
success = ostream_reopen(ps, NULL);
|
|
||||||
|
|
||||||
return success;
|
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);
|
write_pid(ps);
|
||||||
|
|
||||||
// Free the old session
|
// Free the old session
|
||||||
|
|
Loading…
Reference in New Issue