]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: use STR_IN_SET() where appropriate
authorLennart Poettering <lennart@poettering.net>
Thu, 3 Feb 2022 12:42:55 +0000 (13:42 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 3 Feb 2022 18:56:53 +0000 (18:56 +0000)
Follow-up for: 8e98568165ee3db049160045d94ce030dc7fbb79

src/systemctl/systemctl-logind.c

index 9bf24ed5549aca109522f5ac355e200fa3481aa2..d502a7edcf716b63f9b73fa2e228038e593b1da2 100644 (file)
@@ -389,13 +389,15 @@ int logind_show_shutdown(void) {
         if (isempty(action))
                 return log_error_errno(SYNTHETIC_ERRNO(ENODATA), "No scheduled shutdown.");
 
-        if (streq(action, "halt") || streq(action, "poweroff") || streq(action, "exit"))
+        if (STR_IN_SET(action, "halt", "poweroff", "exit"))
                 action = "Shutdown";
         else if (streq(action, "kexec"))
                 action = "Reboot via kexec";
         else if (streq(action, "reboot"))
                 action = "Reboot";
 
+        /* If we don't recognize the action string, we'll show it as-is */
+
         log_info("%s scheduled for %s, use 'shutdown -c' to cancel.",
                  action,
                  FORMAT_TIMESTAMP_STYLE(elapse, arg_timestamp_style));