Fix missing #include (needed for compiling with GCC 10)
[oweals/dinit.git] / src / shutdown.cc
index d669d6b451d56e5146aa261b36067f4d8ceb1331..c82af94d7f2ea87f2d3215ae4ef8f572954921a1 100644 (file)
 #include "service-constants.h"
 #include "dinit-client.h"
 #include "dinit-util.h"
+#include "mconfig.h"
 
 #include "dasynq.h"
 
 // shutdown:  shut down the system
-// This utility communicates with the dinit daemon via a unix socket (/dev/initctl).
+// This utility communicates with the dinit daemon via a unix socket (specified in SYSCONTROLSOCKET).
 
 static constexpr uint16_t min_cp_version = 1;
 static constexpr uint16_t max_cp_version = 1;
@@ -250,7 +251,7 @@ int main(int argc, char **argv)
     auto shutdown_type = shutdown_type_t::POWEROFF;
 
     const char *execname = base_name(argv[0]);
-    if (strcmp(execname, "reboot")) {
+    if (strcmp(execname, "reboot") == 0) {
         shutdown_type = shutdown_type_t::REBOOT;
     }
         
@@ -337,7 +338,7 @@ int main(int argc, char **argv)
             return 1;
         }
         
-        const char *naddr = "/dev/dinitctl";
+        const char *naddr = SYSCONTROLSOCKET;
         
         struct sockaddr_un name;
         name.sun_family = AF_UNIX;