logind: fix getting property OnExternalPower via D-Bus
authorMichael Biebl <biebl@debian.org>
Wed, 12 Oct 2022 09:07:57 +0000 (11:07 +0200)
committerCarlos Henrique Lima Melara <charlesmelara@riseup.net>
Thu, 26 Jun 2025 00:44:53 +0000 (21:44 -0300)
commitd5ea2fa169389f8f2414eb1c582a6e5f1031f51a
tree023be43aa167fb1ebe8fb53e736c2db547aea878
parent98c39947575ce8681c3da6b8b0a4b9cb169dfb01
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