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>
Mon, 27 May 2024 13:02:03 +0000 (14:02 +0100)
commitb8b683d1709611d07f3bfb9813cc6d9686f99b56
treef65ade9471e0f5747f207e9a197e92779819786b
parent8489de7f59e671bf578e42569b01237a93f1e818
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