chiark / gitweb /
shutdown: allow to specify broadcast message when cancelling shutdown
[elogind.git] / src / shutdownd / shutdownd.c
index 6eb8ed9bf8ee2af14d91c25613f0cd3bf88acd79..c0747415fd845dd1d38438d825b29ced7c5d168b 100644 (file)
@@ -136,6 +136,8 @@ static void warn_wall(usec_t n, struct sd_shutdown_command *c) {
                 prefix = "The system is going down for reboot at ";
         else if (c->mode == SD_SHUTDOWN_KEXEC)
                 prefix = "The system is going down for kexec reboot at ";
+        else if (c->mode == SD_SHUTDOWN_NONE)
+                prefix = "The system shutdown has been cancelled at ";
         else
                 assert_not_reached("Unknown mode!");
 
@@ -212,10 +214,8 @@ static int update_schedule_file(struct sd_shutdown_command *c) {
         }
 
         t = cescape(c->wall_message);
-        if (!t) {
-                log_error("Out of memory");
-                return -ENOMEM;
-        }
+        if (!t)
+                return log_oom();
 
         r = fopen_temporary("/run/systemd/shutdown/scheduled", &f, &temp_path);
         if (r < 0) {
@@ -356,6 +356,8 @@ int main(int argc, char *argv[]) {
 
                                 if (!scheduled(&b.command)) {
                                         log_info("Shutdown canceled.");
+                                        if (b.command.warn_wall)
+                                                warn_wall(0, &b.command);
                                         break;
                                 }