From: Lennart Poettering Date: Fri, 15 Dec 2017 15:38:57 +0000 (+0100) Subject: main: split out taint string logging into its own function X-Git-Tag: v237~209^2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51e5ff02a8238df78b077d924605b94088f5fe58;p=thirdparty%2Fsystemd.git main: split out taint string logging into its own function It's sufficiently complex now, let's add our own function for this too. --- diff --git a/src/core/main.c b/src/core/main.c index c6702a9630f..6734a155047 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -2189,6 +2189,25 @@ static void test_summary(Manager *m) { manager_dump_jobs(m, stdout, "\t"); } +static void log_taint_string(Manager *m) { + _cleanup_free_ char *taint = NULL; + + assert(m); + + if (!arg_system) + return; + + taint = manager_taint_string(m); + if (isempty(taint)) + return; + + log_struct(LOG_NOTICE, + LOG_MESSAGE("System is tainted: %s", taint), + "TAINT=%s", taint, + "MESSAGE_ID=" SD_MESSAGE_TAINTED_STR, + NULL); +} + int main(int argc, char *argv[]) { Manager *m = NULL; int r, retval = EXIT_FAILURE; @@ -2497,17 +2516,7 @@ int main(int argc, char *argv[]) { "Loaded units and determined initial transaction in %s.", format_timespan(timespan, sizeof(timespan), after_startup - before_startup, 100 * USEC_PER_MSEC)); - if (arg_system) { - _cleanup_free_ char *taint; - - taint = manager_taint_string(m); - if (!isempty(taint)) - log_struct(LOG_NOTICE, - LOG_MESSAGE("System is tainted: %s", taint), - "TAINT=%s", taint, - "MESSAGE_ID=" SD_MESSAGE_TAINTED_STR, - NULL); - } + log_taint_string(m); if (arg_action == ACTION_TEST) { test_summary(m);