chiark / gitweb /
logind: interpret the can_sleep return value properly
authorMatthias Clasen <mclasen@redhat.com>
Fri, 1 Jun 2012 01:50:23 +0000 (21:50 -0400)
committerLennart Poettering <lennart@poettering.net>
Fri, 1 Jun 2012 13:58:21 +0000 (15:58 +0200)
can_sleep() returns a boolean, so a return value > 0 does not
mean 'na'.

src/login/logind-dbus.c

index 6175d57..f4b232b 100644 (file)
@@ -1068,8 +1068,10 @@ static int bus_manager_can_shutdown_or_sleep(
                 if (r < 0)
                         return r;
 
-                result = "na";
-                goto finish;
+                if (r == 0) {
+                        result = "na";
+                        goto finish;
+                }
         }
 
         r = have_multiple_sessions(connection, m, message, error);