summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd_daemon/lsb/exit-status.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/sd_daemon/lsb/exit-status.go b/sd_daemon/lsb/exit-status.go
index ba5b68b..41eaafd 100644
--- a/sd_daemon/lsb/exit-status.go
+++ b/sd_daemon/lsb/exit-status.go
@@ -1,5 +1,10 @@
package lsb
+import (
+ "os"
+ "sd_daemon/logger"
+)
+
/* systemd daemon(7) recommends using the exit codes defined in the
* "LSB recomendations for SysV init scripts"[1].
*
@@ -60,3 +65,10 @@ const (
EXIT_BUS_ENDPOINT uint8 = 236
EXIT_SMACK_PROCESS_LABEL uint8 = 237
)
+
+func Recover() {
+ if r := recover(); r != nil {
+ logger.Err("panic: %v", r)
+ os.Exit(int(EXIT_FAILURE))
+ }
+}