summaryrefslogtreecommitdiff
path: root/sys-apps/sysvinit/files/sysvinit-3.07-halt.patch
blob: 4e65a912ccdebca22871b1b609ef00badcfbd65b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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;