From 9020cd1aacf26a03cf1bc46b040d42a791a89935 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 8 Jul 2015 16:53:40 +0200 Subject: [PATCH] logging: remove nm_logging_syslog_closelog() Remove nm_logging_syslog_closelog(). The reasons are: - closelog() is optional according to the manual. - we called nm_logging_syslog_closelog() at the end of the main() function. But we have destructors running afterwards, so we were closing the log before logging the last line. Apparently that had no bad consequences either, so why was closelog() even useful? Also, it's hard to determine when we log the last line and only closelog() afterwards. - closelog() does not revert what openlog() did, this is ugly. --- src/main.c | 2 -- src/nm-iface-helper.c | 2 -- src/nm-logging.c | 6 ------ src/nm-logging.h | 1 - 4 files changed, 11 deletions(-) diff --git a/src/main.c b/src/main.c index ad44471df6..7b1e522467 100644 --- a/src/main.c +++ b/src/main.c @@ -486,8 +486,6 @@ main (int argc, char *argv[]) done: g_clear_object (&manager); - nm_logging_syslog_closelog (); - if (global_opt.pidfile && wrote_pidfile) unlink (global_opt.pidfile); diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index cbff221a85..72b69590b4 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -481,8 +481,6 @@ main (int argc, char *argv[]) g_clear_pointer (&hwaddr, g_byte_array_unref); - nm_logging_syslog_closelog (); - if (pidfile && wrote_pidfile) unlink (pidfile); diff --git a/src/nm-logging.c b/src/nm-logging.c index d8dc4291ac..d4fe998ecf 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -488,9 +488,3 @@ nm_logging_syslog_openlog (gboolean debug) } } -void -nm_logging_syslog_closelog (void) -{ - if (syslog_opened) - closelog (); -} diff --git a/src/nm-logging.h b/src/nm-logging.h index d02e16528f..7ed966f85a 100644 --- a/src/nm-logging.h +++ b/src/nm-logging.h @@ -164,6 +164,5 @@ gboolean nm_logging_setup (const char *level, char **bad_domains, GError **error); void nm_logging_syslog_openlog (gboolean debug); -void nm_logging_syslog_closelog (void); #endif /* __NETWORKMANAGER_LOGGING_H__ */