diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-09-17 22:14:24 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-09-17 22:16:01 +0200 |
commit | cd15c4182b2e39bac51afc1c839f9a9f64d1d78f (patch) | |
tree | 89621ed703023284463e92f76db4777fce6c23bb | |
parent | faa368e3376cb5e3e3c27550fdde652f1d3c9584 (diff) |
log: avoid function loop
https://bugs.freedesktop.org/show_bug.cgi?id=54766
-rw-r--r-- | src/shared/log.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/shared/log.c b/src/shared/log.c index 96634645bc..7b0a9144a2 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -73,14 +73,9 @@ static int log_open_console(void) { return 0; if (getpid() == 1) { - console_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC); - if (console_fd < 0) { - log_error("Failed to open /dev/console for logging: %s", strerror(-console_fd)); + if (console_fd < 0) return console_fd; - } - - log_debug("Successfully opened /dev/console for logging."); } else console_fd = STDERR_FILENO; @@ -102,12 +97,8 @@ static int log_open_kmsg(void) { return 0; kmsg_fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC); - if (kmsg_fd < 0) { - log_error("Failed to open /dev/kmsg for logging: %s", strerror(errno)); + if (kmsg_fd < 0) return -errno; - } - - log_debug("Successfully opened /dev/kmsg for logging."); return 0; } @@ -174,13 +165,10 @@ static int log_open_syslog(void) { } else syslog_is_stream = false; - log_debug("Successfully opened syslog for logging."); - return 0; fail: log_close_syslog(); - log_debug("Failed to open syslog for logging: %s", strerror(-r)); return r; } @@ -215,13 +203,10 @@ static int log_open_journal(void) { goto fail; } - log_debug("Successfully opened journal for logging."); - return 0; fail: log_close_journal(); - log_debug("Failed to open journal for logging: %s", strerror(-r)); return r; } |