From c59a3b233bd8893d466c020a2e2695ab545c6e60 Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Sat, 9 Aug 2025 21:55:03 -0500 Subject: [PATCH] Fix unexpected shutdowns when booting Kicksecure from optical media --- usr/src/security-misc/emerg-shutdown.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/usr/src/security-misc/emerg-shutdown.c b/usr/src/security-misc/emerg-shutdown.c index cd310e8..1c89a10 100644 --- a/usr/src/security-misc/emerg-shutdown.c +++ b/usr/src/security-misc/emerg-shutdown.c @@ -793,6 +793,7 @@ void hw_monitor(int argc, char **argv) { char *tmpbuf = NULL; bool device_removed = false; bool device_changed = false; + bool disk_media_changed = false; len = recvmsg(ns, &msg, 0); if (len == -1) { @@ -821,6 +822,10 @@ void hw_monitor(int argc, char **argv) { device_changed = true; goto next_str; } + if (strcmp(tmpbuf, "DISK_MEDIA_CHANGE=1") == 0) { + disk_media_changed = true; + goto next_str; + } if (strncmp(tmpbuf, "DEVNAME=", strlen("DEVNAME=")) == 0) { if (device_removed || device_changed) { @@ -861,6 +866,11 @@ void hw_monitor(int argc, char **argv) { goto next_str; } + if (device_changed && !disk_media_changed) { + free(rem_devname_line); + goto next_str; + } + if (paranoid_mode) { /* Something was removed, we don't care what, shut down now */ kill_system();