* don't redirect when stdout is set with --log stdout
*/
for (fd = 2; fd >= 0; fd--)
- if (logging_to_stdout && isatty(fd) &&
- fd == STDOUT_FILENO) {
- /* Do nothing. */
- } else {
+ if (isatty(fd) &&
+ (fd != STDOUT_FILENO || !logging_to_stdout))
dup2(nullfd, fd);
- }
close(nullfd);
}
}
* stdout
*/
for (fd = 2; fd >= 0; fd--)
- if (logging_to_stdout && isatty(fd) &&
- fd == STDOUT_FILENO) {
- /* Do nothing. */
- } else {
+ if (isatty(fd) &&
+ (fd != STDOUT_FILENO || !logging_to_stdout))
dup2(nullfd, fd);
- }
close(nullfd);
}