logind: fix wall messages for direct shutdown calls
The wall mechanism uses the scheduled_shutdown_type to determine what message to send so it needs to be filled in also for the cases that call for shutdown without schedule. It's really a hackish way. The overall code needs refacturing.
This commit is contained in:
@@ -1957,6 +1957,8 @@ static int method_do_shutdown_or_sleep(
|
||||
static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
Manager *m = userdata;
|
||||
|
||||
(void)free_and_strdup(&m->scheduled_shutdown_type, "poweroff");
|
||||
|
||||
return method_do_shutdown_or_sleep(
|
||||
m, message,
|
||||
SPECIAL_POWEROFF_TARGET,
|
||||
@@ -1972,6 +1974,8 @@ static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error
|
||||
static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
Manager *m = userdata;
|
||||
|
||||
(void)free_and_strdup(&m->scheduled_shutdown_type, "reboot");
|
||||
|
||||
return method_do_shutdown_or_sleep(
|
||||
m, message,
|
||||
SPECIAL_REBOOT_TARGET,
|
||||
@@ -1987,6 +1991,8 @@ static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error *
|
||||
static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
Manager *m = userdata;
|
||||
|
||||
(void)free_and_strdup(&m->scheduled_shutdown_type, "halt");
|
||||
|
||||
return method_do_shutdown_or_sleep(
|
||||
m, message,
|
||||
SPECIAL_HALT_TARGET,
|
||||
@@ -2002,6 +2008,8 @@ static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *er
|
||||
static int method_suspend(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
Manager *m = userdata;
|
||||
|
||||
(void)free_and_strdup(&m->scheduled_shutdown_type, "suspend");
|
||||
|
||||
return method_do_shutdown_or_sleep(
|
||||
m, message,
|
||||
SPECIAL_SUSPEND_TARGET,
|
||||
@@ -2017,6 +2025,8 @@ static int method_suspend(sd_bus_message *message, void *userdata, sd_bus_error
|
||||
static int method_hibernate(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
Manager *m = userdata;
|
||||
|
||||
(void)free_and_strdup(&m->scheduled_shutdown_type, "hibernate");
|
||||
|
||||
return method_do_shutdown_or_sleep(
|
||||
m, message,
|
||||
SPECIAL_HIBERNATE_TARGET,
|
||||
@@ -2032,6 +2042,8 @@ static int method_hibernate(sd_bus_message *message, void *userdata, sd_bus_erro
|
||||
static int method_hybrid_sleep(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
Manager *m = userdata;
|
||||
|
||||
(void)free_and_strdup(&m->scheduled_shutdown_type, "hybrid-sleep");
|
||||
|
||||
return method_do_shutdown_or_sleep(
|
||||
m, message,
|
||||
SPECIAL_HYBRID_SLEEP_TARGET,
|
||||
@@ -2047,6 +2059,8 @@ static int method_hybrid_sleep(sd_bus_message *message, void *userdata, sd_bus_e
|
||||
static int method_suspend_then_hibernate(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
Manager *m = userdata;
|
||||
|
||||
(void)free_and_strdup(&m->scheduled_shutdown_type, "sleep");
|
||||
|
||||
return method_do_shutdown_or_sleep(
|
||||
m, message,
|
||||
SPECIAL_SUSPEND_THEN_HIBERNATE_TARGET,
|
||||
|
||||
Reference in New Issue
Block a user