chiark / gitweb /
systemctl: when called as shutdown, properly handle user specified wall message
authorLennart Poettering <lennart@poettering.net>
Fri, 18 Jun 2010 18:23:17 +0000 (20:23 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 18 Jun 2010 18:23:17 +0000 (20:23 +0200)
src/systemctl.c

index 447a24458adc31071c6189365851e82ec9c2b09c..68e4a909eb6e4b8cc586ba6661ca30277f68af0e 100644 (file)
@@ -39,6 +39,7 @@
 #include "utmp-wtmp.h"
 #include "special.h"
 #include "initreq.h"
 #include "utmp-wtmp.h"
 #include "special.h"
 #include "initreq.h"
+#include "strv.h"
 
 static const char *arg_type = NULL;
 static bool arg_all = false;
 
 static const char *arg_type = NULL;
 static bool arg_all = false;
@@ -139,6 +140,23 @@ static void warn_wall(enum action action) {
         if (arg_no_wall)
                 return;
 
         if (arg_no_wall)
                 return;
 
+        if (arg_wall) {
+                char *p;
+
+                if (!(p = strv_join(arg_wall, " "))) {
+                        log_error("Failed to join strings.");
+                        return;
+                }
+
+                if (*p) {
+                        utmp_wall(p);
+                        free(p);
+                        return;
+                }
+
+                free(p);
+        }
+
         if (!table[action])
                 return;
 
         if (!table[action])
                 return;