]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: make function static
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 30 May 2022 10:38:58 +0000 (12:38 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 1 Jun 2022 07:23:55 +0000 (09:23 +0200)
src/systemctl/systemctl-logind.c
src/systemctl/systemctl-logind.h

index 40521b85954fa5e267e2af2dc15abfcccd71f4ae..239bc777ad78f69f43e1fe9464565c1041cfbc0c 100644 (file)
 #include "terminal-util.h"
 #include "user-util.h"
 
-int logind_set_wall_message(void) {
+static int logind_set_wall_message(sd_bus *bus) {
 #if ENABLE_LOGIND
         _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
-        sd_bus *bus;
         _cleanup_free_ char *m = NULL;
         int r;
 
-        r = acquire_bus(BUS_FULL, &bus);
-        if (r < 0)
-                return r;
-
         m = strv_join(arg_wall, " ");
         if (!m)
                 return log_oom();
@@ -72,7 +67,7 @@ int logind_reboot(enum action a) {
                 return r;
 
         polkit_agent_open_maybe();
-        (void) logind_set_wall_message();
+        (void) logind_set_wall_message(bus);
 
         log_debug("%s org.freedesktop.login1.Manager %s dbus call.", arg_dry_run ? "Would execute" : "Executing", actions[a].method);
 
@@ -310,7 +305,7 @@ int logind_schedule_shutdown(void) {
         if (arg_dry_run)
                 action = strjoina("dry-", action);
 
-        (void) logind_set_wall_message();
+        (void) logind_set_wall_message(bus);
 
         r = bus_call_method(bus, bus_login_mgr, "ScheduleShutdown", &error, NULL, "st", action, arg_when);
         if (r < 0)
@@ -336,7 +331,7 @@ int logind_cancel_shutdown(void) {
         if (r < 0)
                 return r;
 
-        (void) logind_set_wall_message();
+        (void) logind_set_wall_message(bus);
 
         r = bus_call_method(bus, bus_login_mgr, "CancelScheduledShutdown", &error, NULL, NULL);
         if (r < 0)
index 6e73cb762520c576e25e27f42514c180ad75ed75..925f4559c1b131b5f53c9126d7108b1639260def 100644 (file)
@@ -3,8 +3,6 @@
 
 #include "systemctl.h"
 
-int logind_set_wall_message(void);
-
 int logind_reboot(enum action a);
 int logind_check_inhibitors(enum action a);