Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always close file descriptors when deamonised. #2708

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Always close file descriptors when deamonised.
Assertions can be removed in debug builds.

Fixes: f588075
Signed-off-by: Corvin Köhne <[email protected]>
  • Loading branch information
ckoehne committed Dec 16, 2022
commit e2de3db1627076144e9d3b31e0de1253993b3432
6 changes: 3 additions & 3 deletions src/mosquitto.c
Expand Up @@ -160,9 +160,9 @@ static void mosquitto__daemonise(void)
exit(1);
}

assert(freopen("/dev/null", "r", stdin));
assert(freopen("/dev/null", "w", stdout));
assert(freopen("/dev/null", "w", stderr));
freopen("/dev/null", "r", stdin);
freopen("/dev/null", "w", stdout);
freopen("/dev/null", "w", stderr);
#else
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Can't start in daemon mode in Windows.");
#endif
Expand Down