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:
parent
763368943a
commit
9fc932bff1
@ -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 */
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user