login: do not use cast to bool for enum

This commit is contained in:
Yu Watanabe
2019-01-08 02:39:31 +09:00
parent f2e28b5a0d
commit f8bfa31856
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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;
}
+2 -2
View File
@@ -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;