[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 01/02: shepherd: Correctly handle 'quit' exception with an as
From: |
Ludovic Courtès |
Subject: |
[shepherd] 01/02: shepherd: Correctly handle 'quit' exception with an associated value. |
Date: |
Sat, 16 Mar 2019 12:46:18 -0400 (EDT) |
civodul pushed a commit to branch master
in repository shepherd.
commit 6c20e1d43c70ce242f0f3c573de7082d74be2927
Author: Ludovic Courtès <address@hidden>
Date: Sat Mar 16 17:39:05 2019 +0100
shepherd: Correctly handle 'quit' exception with an associated value.
* modules/shepherd.scm (quit-exception-handler): Add optional 'value'
parameter.
---
modules/shepherd.scm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index e241e7a..37ae67d 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -1,5 +1,5 @@
;; shepherd.scm -- The daemon shepherd.
-;; Copyright (C) 2013, 2014, 2016, 2018 Ludovic Courtès <address@hidden>
+;; Copyright (C) 2013, 2014, 2016, 2018, 2019 Ludovic Courtès <address@hidden>
;; Copyright (C) 2002, 2003 Wolfgang Jährling <address@hidden>
;; Copyright (C) 2018 Carlo Zancanaro <address@hidden>
;; Copyright (C) 2018 Danny Milosavljevic <address@hidden>
@@ -319,8 +319,11 @@
;; Maybe we got EPIPE while writing to SOCK, or something like that.
(false-if-exception (close sock)))))
-(define (quit-exception-handler key)
+(define* (quit-exception-handler key #:optional value)
"Handle the 'quit' exception, rebooting if we're running as root."
+ ;; Note: The 'quit' exception does not necessarily have an associated value:
+ ;; compare (exit 1) with (exit).
+
;; Most likely we're receiving 'quit' from the 'stop' method of
;; ROOT-SERVICE. So, if we're running as 'root', just reboot.
(if (zero? (getuid))