]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: simplify var. definition a bit
authorDavid Tardon <dtardon@redhat.com>
Mon, 25 Jul 2022 07:32:16 +0000 (09:32 +0200)
committerDavid Tardon <dtardon@redhat.com>
Mon, 25 Jul 2022 11:23:19 +0000 (13:23 +0200)
src/systemctl/systemctl-list-units.c

index fe1bf2f0a561713fcf07b1e8a81598c2da358960..80defede91110697c8b9363c7e268cf92d4b5abe 100644 (file)
@@ -200,13 +200,11 @@ static int output_units_list(const UnitInfo *unit_infos, size_t c) {
                              "SUB    = The low-level unit activation state, values depend on unit type.");
                         if (job_count > 0)
                                 puts("JOB    = Pending job for the unit.\n");
-                        on = ansi_highlight();
-                        off = ansi_normal();
-                } else {
-                        on = ansi_highlight_red();
-                        off = ansi_normal();
                 }
 
+                on = records > 0 ? ansi_highlight() : ansi_highlight_red();
+                off = ansi_normal();
+
                 if (arg_all || strv_contains(arg_states, "inactive"))
                         printf("%s%zu loaded units listed.%s\n"
                                "To show all installed unit files use 'systemctl list-unit-files'.\n",