systemctl: use STR_IN_SET() where appropriate

Follow-up for: 8e98568165
This commit is contained in:
Lennart Poettering
2022-02-03 18:56:53 +00:00
committed by Luca Boccassi
parent f83da717d9
commit f80c3d5c7a
+3 -1
View 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));