chiark / gitweb /
main: move make_null_stdio() to util.c
authorLennart Poettering <lennart@poettering.net>
Wed, 27 Oct 2010 03:45:57 +0000 (05:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 27 Oct 2010 03:45:57 +0000 (05:45 +0200)
src/main.c
src/util.c
src/util.h

index 7dad015e3034ed86ad23508d1270185b5c86162b..83cf2e70578e971c6c5f16984189859d50222d6d 100644 (file)
@@ -180,20 +180,6 @@ static void install_crash_handler(void) {
         sigaction_many(&sa, SIGNALS_CRASH_HANDLER, -1);
 }
 
-static int make_null_stdio(void) {
-        int null_fd, r;
-
-        if ((null_fd = open("/dev/null", O_RDWR|O_NOCTTY)) < 0) {
-                log_error("Failed to open /dev/null: %m");
-                return -errno;
-        }
-
-        if ((r = make_stdio(null_fd)) < 0)
-                log_warning("Failed to dup2() device: %s", strerror(-r));
-
-        return r;
-}
-
 static int console_setup(bool do_reset) {
         int tty_fd, r;
 
index d653d6b549beac73ff3884994d2d6334993db2a5..9a82c71dcb249b1e268f8959385fecbc05782f59 100644 (file)
@@ -2605,6 +2605,15 @@ int make_stdio(int fd) {
         return 0;
 }
 
+int make_null_stdio(void) {
+        int null_fd;
+
+        if ((null_fd = open("/dev/null", O_RDWR|O_NOCTTY)) < 0)
+                return -errno;
+
+        return make_stdio(null_fd);
+}
+
 bool is_clean_exit(int code, int status) {
 
         if (code == CLD_EXITED)
index 71889f1425762b256a0874870995896d51dca50a..ddf089cfe791ec91a71effb91c9470c38fe21372 100644 (file)
@@ -265,6 +265,7 @@ char *format_timestamp_pretty(char *buf, size_t l, usec_t t);
 char *format_timespan(char *buf, size_t l, usec_t t);
 
 int make_stdio(int fd);
+int make_null_stdio(void);
 
 bool is_clean_exit(int code, int status);
 bool is_clean_exit_lsb(int code, int status);