logind: fix getting property OnExternalPower via D-Bus
authorMichael Biebl <biebl@debian.org>
Wed, 12 Oct 2022 09:07:57 +0000 (11:07 +0200)
committerLuca Boccassi <bluca@debian.org>
Sun, 18 Jun 2023 14:55:54 +0000 (15:55 +0100)
commit1afc38d687ff310976b2f5d1750cb2dad0f3c383
treed24a9f9e1b6676260282beef20defef19f388190
parent89ad65a09aefaa807f9e6263fb7571925d5b20f4
logind: fix getting property OnExternalPower via D-Bus

The BUS_DEFINE_PROPERTY_GET_GLOBAL macro requires a value as third
argument, so we need to call manager_is_on_external_power(). Otherwise
the function pointer is interpreted as a boolean and always returns
true:

```
$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager OnExternalPower
b true
$ /lib/systemd/systemd-ac-power  --verbose
no
```

Thanks: Helmut Grohne <helmut@subdivi.de>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021644
(cherry picked from commit 63168cb517a556b2f4f175b365f5a4b4c7e85150)

Gbp-Pq: Name logind-fix-getting-property-OnExternalPower-via-D-Bus.patch
src/login/logind-dbus.c