summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2023-07-27 09:48:34 -0400
committerMike Gilbert <floppym@gentoo.org>2023-07-27 09:49:25 -0400
commit07b943791fb87acef33c0e50ea196e63937d6ffb (patch)
tree6c5c34d0a683413f093e879bdd5be54351159c16 /sys-apps/sysvinit/files
parentapp-emacs/clojure-mode: Stabilize 5.16.1 amd64, #911309 (diff)
downloadgentoo-07b943791fb87acef33c0e50ea196e63937d6ffb.tar.gz
gentoo-07b943791fb87acef33c0e50ea196e63937d6ffb.tar.bz2
gentoo-07b943791fb87acef33c0e50ea196e63937d6ffb.zip
sys-apps/sysvinit: prevent 'halt' from powering off the machine
If you want to power off, use 'poweroff' or 'halt -p' instead. Closes: https://bugs.gentoo.org/911257 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'sys-apps/sysvinit/files')
-rw-r--r--sys-apps/sysvinit/files/sysvinit-3.07-halt.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/sys-apps/sysvinit/files/sysvinit-3.07-halt.patch b/sys-apps/sysvinit/files/sysvinit-3.07-halt.patch
new file mode 100644
index 000000000000..4e65a912ccde
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-3.07-halt.patch
@@ -0,0 +1,53 @@
+https://github.com/slicer69/sysvinit/pull/18
+https://bugs.gentoo.org/911257
+
+From fca101c2ff428eb765958ae6e3aaa0eb1adc0fdf Mon Sep 17 00:00:00 2001
+From: Jesse <jsmith@resonatingmedia.com>
+Date: Thu, 27 Jul 2023 00:39:53 -0300
+Subject: [PATCH] Floppym provided patch which causes the halt command to call
+ "shutdown -h -H" instead of "shutdown -h" when halt is invoked without
+ parameters. This forces the shutdown command to set the INIT_HALT variable
+ and assume, unless other conditions apply, that the "halt" call really wants
+ to halt the machine and INIT_HALT should be set. In other words we assume
+ halt wants to halt unless told otherwise. Addresses downstream Gentoo bug ID
+ 911257.
+
+---
+ doc/Changelog | 11 +++++++++++
+ src/halt.c | 4 ++--
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/doc/Changelog b/doc/Changelog
+index c00f6ef..b902756 100644
+--- a/doc/Changelog
++++ b/doc/Changelog
+@@ -1,3 +1,14 @@
++sysvinit (3.08) unreleased; urgency=low
++ * Floppym provided patch which causes the halt command
++ to call "shutdown -h -H" instead of "shutdown -h" when
++ halt is invoked without parameters. This forces the shutdown
++ command to set the INIT_HALT variable and assume, unless other
++ conditions apply, that the "halt" call really wants to halt the
++ machine and INIT_HALT should be set. In other words we
++ assume halt wants to halt unless told otherwise.
++ Addresses downstream Gentoo bug ID 911257.
++
++
+ sysvinit (3.07) released; urgency=low
+ * Fixed killall5 so that processes in the omit list are
+ not sent any signals, including SIGSTOP.
+diff --git a/src/halt.c b/src/halt.c
+index a469147..9bd3a4d 100644
+--- a/src/halt.c
++++ b/src/halt.c
+@@ -162,8 +162,8 @@ void do_shutdown(char *fl, int should_poweroff, char *tm)
+
+ args[i++] = "shutdown";
+ args[i++] = fl;
+- if ( (! strcmp(fl, "-h") ) && (should_poweroff) )
+- args[i++] = "-P";
++ if (! strcmp(fl, "-h"))
++ args[i++] = (should_poweroff ? "-P" : "-H");
+ if (tm) {
+ args[i++] = "-t";
+ args[i++] = tm;