summaryrefslogtreecommitdiff
path: root/debian/patches/shutdown0002-xxx-halt-hack.patch
blob: 8379275286a6b97a529bc39748d025375249cdf2 (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
From 8ff13a86d9a26a479164ea251eb0d3c00b95c726 Mon Sep 17 00:00:00 2001
From: Justus Winter <justus@gnupg.org>
Date: Fri, 22 Apr 2016 02:53:44 +0200
Subject: [PATCH hurd 2/2] xxx halt hack

---
 sutils/halt.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sutils/halt.c b/sutils/halt.c
index 08f754c..4d36ca2 100644
--- a/sutils/halt.c
+++ b/sutils/halt.c
@@ -25,6 +25,8 @@
 #include <argp.h>
 #include <error.h>
 #include <hurd.h>
+#include <hurd/paths.h>
+#include <hurd/startup.h>
 #include <version.h>
 
 const char *argp_program_version = STANDARD_HURD_VERSION (halt);
@@ -32,9 +34,17 @@ const char *argp_program_version = STANDARD_HURD_VERSION (halt);
 int
 main (int argc, char *argv[])
 {
+  error_t err;
+  file_t server;
   struct argp argp = {0, 0, 0, "Halt the system"};
   argp_parse (&argp, argc, argv, 0, 0, 0);
-  reboot (RB_HALT);
-  error (1, errno, "reboot");
+
+  server = file_name_lookup (_SERVERS_STARTUP, 0, 0);
+  if (! MACH_PORT_VALID (server))
+    error (1, errno, _HURD_STARTUP);
+
+  err = startup_reboot (server, MACH_PORT_NULL, RB_HALT);
+  if (err)
+    error (1, err, "reboot");
   return 1;
 }
-- 
2.1.4