From f8bfa318561c375377ac4143ca19aa9cb35d8fa6 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 8 Jan 2019 02:39:31 +0900 Subject: [PATCH] login: do not use cast to bool for enum --- src/login/logind-action.c | 2 +- src/login/logind-dbus.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/login/logind-action.c b/src/login/logind-action.c index e4e6c901911..6c9366761da 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -121,7 +121,7 @@ int manager_handle_action( return -EOPNOTSUPP; } - if (m->action_what) { + if (m->action_what > 0) { log_debug("Action already in progress, ignoring."); return -EALREADY; } diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index bd9f5ac4d6c..4ab0dcb595e 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1773,7 +1773,7 @@ static int method_do_shutdown_or_sleep( return r; /* Don't allow multiple jobs being executed at the same time */ - if (m->action_what) + if (m->action_what > 0) return sd_bus_error_setf(error, BUS_ERROR_OPERATION_IN_PROGRESS, "There's already a shutdown or sleep operation in progress"); if (sleep_verb) { @@ -2012,7 +2012,7 @@ static int manager_scheduled_shutdown_handler( assert_not_reached("unexpected shutdown type"); /* Don't allow multiple jobs being executed at the same time */ - if (m->action_what) { + if (m->action_what > 0) { r = -EALREADY; log_error("Scheduled shutdown to %s failed: shutdown or sleep operation already in progress", target); goto error; -- 2.47.3