Blob Blame History Raw
From ee4cb7618ab6232c78865357a153d99a4023ad13 Mon Sep 17 00:00:00 2001
From: Alan Jenkins <alan.christopher.jenkins@gmail.com>
Date: Thu, 24 Aug 2017 15:21:21 +0100
Subject: [PATCH] logind: tighten assertion in execute_shutdown_or_sleep()

Following commit b498d6ea, I belated realized we should tighten the
assertions as well, to make sure that we're setting `m->action_what` to
represent an action in progress.  (The check for an action in progress is
to compare `m->action_what` to zero)

(cherry picked from commit b61fa4e00166b2bf593e0f6edbb277543f03915f)
---
 src/login/logind-dbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index e868a48f8c..ba5cb19c6b 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1514,7 +1514,7 @@ static int execute_shutdown_or_sleep(
         int r;
 
         assert(m);
-        assert(w >= 0);
+        assert(w > 0);
         assert(w < _INHIBIT_WHAT_MAX);
         assert(unit_name);
 
@@ -1661,7 +1661,7 @@ int bus_manager_shutdown_or_sleep_now_or_later(
 
         assert(m);
         assert(unit_name);
-        assert(w >= 0);
+        assert(w > 0);
         assert(w <= _INHIBIT_WHAT_MAX);
         assert(!m->action_job);