nohup: Don't leak fd used to open nohup.out

Since we may redirect stdout, stderr, or both to the file description
referring to the nohup.out file, there is no need to keep the fd that
created that file description around.
This commit is contained in:
Kemal Zebari 2023-07-19 14:54:07 -07:00 committed by Andreas Kling
parent 7da055e3e1
commit 590f0f85e0
Notes: sideshowbarker 2024-07-17 04:03:27 +09:00

View file

@ -44,6 +44,8 @@ void dup_out_file(int fd_to_redirect)
exit(127);
}
MUST(Core::System::close(fd));
if (fd_to_redirect != STDERR_FILENO)
outln(stderr, "appending output to {}", path);
}