]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: define less stuff when !HAVE_SYSV_COMPAT
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 26 Mar 2019 09:19:19 +0000 (10:19 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 26 Mar 2019 18:06:48 +0000 (19:06 +0100)
We'd translate our action to sysv runlevel action, only to discard the result
in talk_initctl(). Let's just ifdef the whole thing away.

Fixes #12103.

src/systemctl/systemctl.c
src/systemctl/sysv-compat.c
src/systemctl/sysv-compat.h

index 4dd5cd37681b2ff5e1135863b0248466bfadc757..d162ddee5a4e3bd1b6984db20ef8471f97f08412 100644 (file)
@@ -8727,7 +8727,6 @@ _pure_ static int action_to_runlevel(void) {
         };
 
         assert(arg_action >= 0 && arg_action < _ACTION_MAX);
-
         return table[arg_action];
 }
 #endif
@@ -8826,9 +8825,11 @@ static int start_with_fallback(void) {
         if (start_unit(0, NULL, NULL) == 0)
                 return 0;
 
+#if HAVE_SYSV_COMPAT
         /* Nothing else worked, so let's try /dev/initctl */
         if (talk_initctl(action_to_runlevel()) > 0)
                 return 0;
+#endif
 
         return log_error_errno(SYNTHETIC_ERRNO(EIO),
                                "Failed to talk to init daemon.");
index 72a2f5796570e6bcc2441f86bc71147ba7fddc14..a85b2dfe4b4970c4e4d96ef7b41c1599353890e5 100644 (file)
@@ -7,8 +7,8 @@
 #include "strv.h"
 #include "sysv-compat.h"
 
-int talk_initctl(char rl) {
 #if HAVE_SYSV_COMPAT
+int talk_initctl(char rl) {
         struct init_request request;
         _cleanup_close_ int fd = -1;
         const char *p;
@@ -44,10 +44,8 @@ int talk_initctl(char rl) {
                 return log_error_errno(r, "Failed to write to %s: %m", p);
 
         return 1;
-#else
-        return 0;
-#endif
 }
+#endif
 
 int parse_shutdown_time_spec(const char *t, usec_t *ret) {
         assert(t);
index 73329ec42a41181d7b14fb4a279d67240f0b181f..e79919217ca3fd319b74f47166d3a15dcd9114f0 100644 (file)
@@ -3,7 +3,10 @@
 
 #include "time-util.h"
 
+#if HAVE_SYSV_COMPAT
 int talk_initctl(char runlevel);
+#endif
+
 int parse_shutdown_time_spec(const char *t, usec_t *ret);
 
 /* The init script exit codes for the LSB 'status' verb. (This is different from the 'start' verb, whose exit