diff --git a/src/systemctl/systemctl-logind.c b/src/systemctl/systemctl-logind.c index e54067397a..495cccd828 100644 --- a/src/systemctl/systemctl-logind.c +++ b/src/systemctl/systemctl-logind.c @@ -152,9 +152,9 @@ int logind_check_inhibitors(enum action a) { return 0; r = acquire_bus_full(BUS_FULL, /* graceful = */ true, &bus); - if (r == -ECONNREFUSED && geteuid() == 0) - return 0; /* When D-Bus is not running, allow root to force a shutdown. E.g. when running at - * the emergency console. */ + if (ERRNO_IS_NEG_DISCONNECT(r) && geteuid() == 0) + return 0; /* When D-Bus is not running (ECONNREFUSED) or D-Bus socket is not created (ENOENT), + * allow root to force a shutdown. E.g. when running at the emergency console. */ if (r < 0) return r;