diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-02-16 22:56:47 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-02-16 22:56:47 +0100 |
commit | 81bb3ca13cd3b2e3dbc0a72821e0ae595a1e086f (patch) | |
tree | 31583a53d4f08f2684b161b985e3669f59936647 | |
parent | 3414394e0b978501a4b0dd9c4582a60ffce238e9 (diff) | |
download | systemd-81bb3ca13cd3b2e3dbc0a72821e0ae595a1e086f.tar.gz |
logind: fix internal types used for EnableWallMessages
The value is used as a boolean, but stored in an unsigned. It's exposed
with sd-bus default boolean handling which however expects a (signed)
int. Let's clear this up, and use "bool" for this everywhere in
non-local scope, and make sure that when we pass it to sd-bus we
properly pass an "int".
-rw-r--r-- | src/login/logind-dbus.c | 8 | ||||
-rw-r--r-- | src/login/logind.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 5ba0b1748e..30bddb5402 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2058,10 +2058,10 @@ static int update_schedule_file(Manager *m) { fprintf(f, "USEC="USEC_FMT"\n" - "WARN_WALL=%i\n" + "WARN_WALL=%s\n" "MODE=%s\n", m->scheduled_shutdown_timeout, - m->enable_wall_messages, + one_zero(m->enable_wall_messages), handle_action_to_string(m->scheduled_shutdown_type->handle)); if (!isempty(m->wall_message)) { @@ -3116,7 +3116,7 @@ static int method_set_wall_message( int r; Manager *m = userdata; char *wall_message; - unsigned enable_wall_messages; + int enable_wall_messages; assert(message); assert(m); @@ -3277,7 +3277,7 @@ static int method_inhibit(sd_bus_message *message, void *userdata, sd_bus_error static const sd_bus_vtable manager_vtable[] = { SD_BUS_VTABLE_START(0), - SD_BUS_WRITABLE_PROPERTY("EnableWallMessages", "b", NULL, NULL, offsetof(Manager, enable_wall_messages), 0), + SD_BUS_WRITABLE_PROPERTY("EnableWallMessages", "b", bus_property_get_bool, bus_property_set_bool, offsetof(Manager, enable_wall_messages), 0), SD_BUS_WRITABLE_PROPERTY("WallMessage", "s", NULL, NULL, offsetof(Manager, wall_message), 0), SD_BUS_PROPERTY("NAutoVTs", "u", NULL, offsetof(Manager, n_autovts), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/login/logind.h b/src/login/logind.h index 5647e5069c..af9af9e457 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -87,7 +87,7 @@ struct Manager { bool unlink_nologin; char *wall_message; - unsigned enable_wall_messages; + bool enable_wall_messages; sd_event_source *wall_message_timeout_source; bool shutdown_dry_run; |