From: Michael Biebl Date: Wed, 12 Oct 2022 09:07:57 +0000 (+0200) Subject: logind: fix getting property OnExternalPower via D-Bus X-Git-Tag: archive/raspbian/247.3-7+rpi1+deb11u7^2~45 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d5ea2fa169389f8f2414eb1c582a6e5f1031f51a;p=systemd.git 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 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 --- diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index b95af1a9..cf2be794 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -352,7 +352,7 @@ static int property_get_scheduled_shutdown( static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_handle_action, handle_action, HandleAction); static BUS_DEFINE_PROPERTY_GET(property_get_docked, "b", Manager, manager_is_docked_or_external_displays); static BUS_DEFINE_PROPERTY_GET(property_get_lid_closed, "b", Manager, manager_is_lid_closed); -static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_on_external_power, "b", manager_is_on_external_power); +static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_on_external_power, "b", manager_is_on_external_power()); static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_compat_user_tasks_max, "t", CGROUP_LIMIT_MAX); static BUS_DEFINE_PROPERTY_GET_REF(property_get_hashmap_size, "t", Hashmap *, (uint64_t) hashmap_size);