Keep fd 2 open as our log fd, so other things that write there (e.g. assert()) work sanely.

This commit is contained in:
Ian Gulliver
2016-03-09 13:06:26 -08:00
parent fc14de31ff
commit 87f82b0327
2 changed files with 12 additions and 15 deletions

View File

@@ -76,7 +76,6 @@ int main(int argc, char *argv[]) {
reopen(STDIN_FILENO, "/dev/null", O_RDONLY);
reopen(STDOUT_FILENO, "/dev/full", O_WRONLY);
reopen(STDERR_FILENO, "/dev/full", O_WRONLY);
peer_loop();
@@ -104,7 +103,6 @@ int main(int argc, char *argv[]) {
assert(!close(STDIN_FILENO));
assert(!close(STDOUT_FILENO));
assert(!close(STDERR_FILENO));
return EXIT_SUCCESS;
}