diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-10-27 05:45:57 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-10-27 05:45:57 +0200 |
commit | ade509ce73ba1de3bcda8b012961a3045f721df7 (patch) | |
tree | 6d814e6d7988f8c871c2cc63e8a56c0d210696dd /src | |
parent | 4690698d4949d8b42e4c3a87944075ceaf685e5a (diff) |
main: move make_null_stdio() to util.c
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 14 | ||||
-rw-r--r-- | src/util.c | 9 | ||||
-rw-r--r-- | src/util.h | 1 |
3 files changed, 10 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c index 7dad015e30..83cf2e7057 100644 --- a/src/main.c +++ b/src/main.c @@ -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; diff --git a/src/util.c b/src/util.c index d653d6b549..9a82c71dcb 100644 --- a/src/util.c +++ b/src/util.c @@ -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) diff --git a/src/util.h b/src/util.h index 71889f1425..ddf089cfe7 100644 --- a/src/util.h +++ b/src/util.h @@ -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); |