1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 17:51:22 +03:00

tree-wide: print warning in a failure case of make_null_stdio() (#4320)

The make_null_stdio() may fail. Let's check its result and print
warning message instead of keeping silence.
This commit is contained in:
0xAX 2016-10-10 05:55:24 +03:00 committed by Zbigniew Jędrzejewski-Szmek
parent 763368943a
commit 9fc932bff1
2 changed files with 5 additions and 2 deletions

View File

@ -1532,7 +1532,8 @@ int main(int argc, char *argv[]) {
* need to do that for user instances since they never log * need to do that for user instances since they never log
* into the console. */ * into the console. */
log_show_color(colors_enabled()); log_show_color(colors_enabled());
make_null_stdio(); if (make_null_stdio() < 0)
log_warning_errno(errno, "Failed to redirect standard streams to /dev/null: %m");
} }
/* Initialize default unit */ /* Initialize default unit */

View File

@ -1739,7 +1739,9 @@ int main(int argc, char *argv[]) {
/* connect /dev/null to stdin, stdout, stderr */ /* connect /dev/null to stdin, stdout, stderr */
if (log_get_max_level() < LOG_DEBUG) if (log_get_max_level() < LOG_DEBUG)
(void) make_null_stdio(); if (make_null_stdio() < 0)
log_warning_errno(errno, "Failed to redirect standard streams to /dev/null: %m");
pid = fork(); pid = fork();
switch (pid) { switch (pid) {