main: split out taint string logging into its own function
It's sufficiently complex now, let's add our own function for this too.
This commit is contained in:
+20
-11
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user