From 70140c4f0c80a9e51ed1ea51915ac2a6407d1a2b Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Thu, 23 Aug 2018 08:35:42 +0200 Subject: Prep v239: Fix ustreams move of the unneeded target_table into its own also unneeded function. --- src/login/logind-action.c | 9 +++++++-- src/login/logind-action.h | 2 ++ src/login/logind-dbus.c | 8 ++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/login/logind-action.c b/src/login/logind-action.c index 497164e41..a9f739129 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -20,6 +20,8 @@ #include "fileio.h" #include "sd-messages.h" #include "strv.h" + +#if 0 /// elogind does this itself. No target table required const char* manager_target_for_action(HandleAction handle) { static const char * const target_table[_HANDLE_ACTION_MAX] = { [HANDLE_POWEROFF] = SPECIAL_POWEROFF_TARGET, @@ -37,6 +39,7 @@ const char* manager_target_for_action(HandleAction handle) { return target_table[handle]; return NULL; } +#endif // 0 int manager_handle_action( Manager *m, @@ -56,13 +59,13 @@ int manager_handle_action( [HANDLE_SUSPEND_THEN_HIBERNATE] = "Suspending, then hibernating...", }; -#if 0 /// elogind does this itself. No target table required -#endif // 0 _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; InhibitWhat inhibit_operation; Inhibitor *offending = NULL; bool supported; +#if 0 /// elogind uses its own variant, which can use the handle directly. const char *target; +#endif // 0 int r; assert(m); @@ -136,7 +139,9 @@ int manager_handle_action( return -EALREADY; } +#if 0 /// elogind uses its own variant, which can use the handle directly. assert_se(target = manager_target_for_action(handle)); +#endif // 0 inhibit_operation = IN_SET(handle, HANDLE_SUSPEND, HANDLE_HIBERNATE, HANDLE_HYBRID_SLEEP, diff --git a/src/login/logind-action.h b/src/login/logind-action.h index a45aab785..bc2d36050 100644 --- a/src/login/logind-action.h +++ b/src/login/logind-action.h @@ -31,6 +31,8 @@ int manager_handle_action( const char* handle_action_to_string(HandleAction h) _const_; HandleAction handle_action_from_string(const char *s) _pure_; +#if 0 /// elogind does this itself. No target table required const char* manager_target_for_action(HandleAction handle); +#endif // 0 CONFIG_PARSER_PROTOTYPE(config_parse_handle_action); diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 2f7782a13..63a206ce2 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2367,11 +2367,11 @@ static int method_can_shutdown_or_sleep( blocked = manager_is_inhibited(m, w, INHIBIT_BLOCK, NULL, false, true, uid, NULL); handle = handle_action_from_string(sleep_verb); +#if 0 /// elogind uses its own variant, which can use the handle directly. if (handle >= 0) { const char *target; target = manager_target_for_action(handle); -#if 0 /// elogind does not support systemd units units. A valid handle is enough if (target) { _cleanup_free_ char *load_state = NULL; @@ -2380,20 +2380,16 @@ static int method_can_shutdown_or_sleep( return r; if (!streq(load_state, "loaded")) { -#else - if (NULL == target) { -#endif // 0 result = "no"; goto finish; -#if 0 /// one less with elogind... } -#endif // 0 } #else if ( (handle <= HANDLE_IGNORE) || (handle >= _HANDLE_ACTION_MAX) ) { result = "no"; goto finish; } +#endif // 0 if (multiple_sessions) { r = bus_test_polkit(message, CAP_SYS_BOOT, action_multiple_sessions, NULL, UID_INVALID, &challenge, error); -- cgit v1.2.3