diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1392,7 +1392,7 @@ static void | |||
1392 | control_persist_detach(void) | 1392 | control_persist_detach(void) |
1393 | { | 1393 | { |
1394 | pid_t pid; | 1394 | pid_t pid; |
1395 | int devnull; | 1395 | int devnull, keep_stderr; |
1396 | 1396 | ||
1397 | debug("%s: backgrounding master process", __func__); | 1397 | debug("%s: backgrounding master process", __func__); |
1398 | 1398 | ||
@@ -1423,8 +1423,10 @@ control_persist_detach(void) | |||
1423 | error("%s: open(\"/dev/null\"): %s", __func__, | 1423 | error("%s: open(\"/dev/null\"): %s", __func__, |
1424 | strerror(errno)); | 1424 | strerror(errno)); |
1425 | } else { | 1425 | } else { |
1426 | keep_stderr = log_is_on_stderr() && debug_flag; | ||
1426 | if (dup2(devnull, STDIN_FILENO) == -1 || | 1427 | if (dup2(devnull, STDIN_FILENO) == -1 || |
1427 | dup2(devnull, STDOUT_FILENO) == -1) | 1428 | dup2(devnull, STDOUT_FILENO) == -1 || |
1429 | (!keep_stderr && dup2(devnull, STDERR_FILENO) == -1)) | ||
1428 | error("%s: dup2: %s", __func__, strerror(errno)); | 1430 | error("%s: dup2: %s", __func__, strerror(errno)); |
1429 | if (devnull > STDERR_FILENO) | 1431 | if (devnull > STDERR_FILENO) |
1430 | close(devnull); | 1432 | close(devnull); |