summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorLudwig Nussel <ludwig.nussel@suse.de>2022-02-07 10:56:19 +0100
committerLudwig Nussel <ludwig.nussel@suse.de>2022-02-14 09:35:12 +0100
commitd2fc0ecf9a217aad46fe4b792640fb8911599d93 (patch)
tree9bbf38364e3f7845d43da9fdb35f00c1cd068dfb /src/login
parent138224fc807091d31f19a3b22f066d6044626001 (diff)
downloadsystemd-d2fc0ecf9a217aad46fe4b792640fb8911599d93.tar.gz
logind: style fixes
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-action.c7
-rw-r--r--src/login/logind-action.h4
-rw-r--r--src/login/logind-dbus.c17
3 files changed, 9 insertions, 19 deletions
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
index a4f3f6c3f6..00ef211964 100644
--- a/src/login/logind-action.c
+++ b/src/login/logind-action.c
@@ -117,13 +117,6 @@ static const ActionTableItem action_table[_HANDLE_ACTION_MAX] = {
},
};
-const char* manager_target_for_action(HandleAction handle) {
- assert(handle >= 0);
- assert(handle < (ssize_t) ELEMENTSOF(action_table));
-
- return action_table[handle].target;
-}
-
const ActionTableItem* manager_item_for_handle(HandleAction handle) {
assert(handle >= 0);
assert(handle < (ssize_t) ELEMENTSOF(action_table));
diff --git a/src/login/logind-action.h b/src/login/logind-action.h
index 710aa4931d..621c5f97bc 100644
--- a/src/login/logind-action.h
+++ b/src/login/logind-action.h
@@ -37,8 +37,7 @@ struct ActionTableItem {
SleepOperation sleep_operation;
const char* message_id;
const char* message;
- const char* log_str;
-
+ const char* log_message;
};
int manager_handle_action(
@@ -51,7 +50,6 @@ int manager_handle_action(
const char* handle_action_to_string(HandleAction h) _const_;
HandleAction handle_action_from_string(const char *s) _pure_;
-const char* manager_target_for_action(HandleAction handle);
const ActionTableItem* manager_item_for_handle(HandleAction handle);
HandleAction manager_handle_for_item(const ActionTableItem* a);
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 2cdd5b9084..ef31ec654e 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1499,13 +1499,13 @@ static int bus_manager_log_shutdown(
Manager *m,
const ActionTableItem *a) {
- const char *message, *log_str;
+ const char *message, *log_message;
assert(m);
assert(a);
message = a->message;
- log_str = a->log_str;
+ log_message = a->log_message;
if (message)
message = strjoina("MESSAGE=", message);
@@ -1517,13 +1517,13 @@ static int bus_manager_log_shutdown(
else
message = strjoina(message, " (", m->wall_message, ").");
- if (log_str)
- log_str = strjoina("SHUTDOWN=", log_str);
+ if (log_message)
+ log_message = strjoina("SHUTDOWN=", log_message);
return log_struct(LOG_NOTICE,
"MESSAGE_ID=%s", a->message_id ? a->message_id : SD_MESSAGE_SHUTDOWN_STR,
message,
- log_str);
+ log_message);
}
static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) {
@@ -2244,7 +2244,7 @@ static int method_cancel_scheduled_shutdown(sd_bus_message *message, void *userd
cancelled = m->scheduled_shutdown_type
&& !IN_SET(m->scheduled_shutdown_type->handle, HANDLE_IGNORE, _HANDLE_ACTION_INVALID);
if (!cancelled)
- goto done;
+ return sd_bus_reply_method_return(message, "b", false);
a = m->scheduled_shutdown_type;
if (!a->polkit_action)
@@ -2283,8 +2283,7 @@ static int method_cancel_scheduled_shutdown(sd_bus_message *message, void *userd
username, tty, logind_wall_tty_filter, m);
}
-done:
- return sd_bus_reply_method_return(message, "b", cancelled);
+ return sd_bus_reply_method_return(message, "b", true);
}
static int method_can_shutdown_or_sleep(
@@ -2330,7 +2329,7 @@ static int method_can_shutdown_or_sleep(
if (handle >= 0) {
const char *target;
- target = manager_target_for_action(handle);
+ target = manager_item_for_handle(handle)->target;
if (target) {
_cleanup_free_ char *load_state = NULL;