Message ID | ac17fad1-baf1-75ad-843d-cab8d17f1b2e@hetzner.com |
---|---|
State | New |
Headers | show |
Series | qemu-nbd: Close inherited stderr | expand |
diff --git a/qemu-nbd.c b/qemu-nbd.c index 108a51f7e..f2981e18a 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -1032,8 +1032,15 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - /* ... close the descriptor we inherited and go on. */ + /* ... close the descriptor we inherited and ... */ close(stderr_fd[1]); + + /* ... also close the old_stderr IF fork_process is false otherwise + * it will never get closed. + */ + if (!fork_process) { + close(old_stderr); + } } else { bool errors = false;