diff options
-rw-r--r-- | misc-utils/logger.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/misc-utils/logger.c b/misc-utils/logger.c index 8908dfcc1..9947b75e4 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -242,9 +242,10 @@ static int unix_socket(struct logger_ctl *ctl, const char *path, const int socke if (ctl->unix_socket_errors) err(EXIT_FAILURE, _("socket %s"), path); else - /* See --socket-errors manual page entry for - * explanation of this strange exit. */ - exit(EXIT_SUCCESS); + /* openlog(3) compatibility, socket errors are + * not reported, but ignored silently */ + ctl->noact = 1; + return -1; } return fd; } @@ -685,7 +686,7 @@ static void logger_stdin(struct logger_ctl *ctl) static void logger_close(const struct logger_ctl *ctl) { - if (close(ctl->fd) != 0) + if (ctl->fd != -1 && close(ctl->fd) != 0) err(EXIT_FAILURE, _("close failed")); free(ctl->hdr); } |