logind: fix getting property OnExternalPower via D-Bus
authorMichael Biebl <biebl@debian.org>
Wed, 12 Oct 2022 09:07:57 +0000 (11:07 +0200)
committerAdrian Bunk <bunk@debian.org>
Thu, 29 Jun 2023 13:57:02 +0000 (14:57 +0100)
commit4b36075502ff91602ce59591df24f94268c4c018
tree6cc5a58eec1d5beef6f8f4dba05cb120c1a69ce2
parent3febcb5989fcc38b1a64a4ab719ebfa902908da7
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

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