From: 0xAX <0xAX@users.noreply.github.com> Date: Mon, 10 Oct 2016 02:55:24 +0000 (+0300) Subject: tree-wide: print warning in a failure case of make_null_stdio() (#4320) X-Git-Tag: v232~131 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9fc932bff1e2058885fc458412b3c94d586cb586;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/core/main.c b/src/core/main.c index 6fe440277ec..e88362b7fe6 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1532,7 +1532,8 @@ int main(int argc, char *argv[]) { * need to do that for user instances since they never log * into the console. */ 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 */ diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 19f1c291984..6000d9c7ec6 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1739,7 +1739,9 @@ int main(int argc, char *argv[]) { /* connect /dev/null to stdin, stdout, stderr */ 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(); switch (pid) {