guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 02/02: system: Throw an exception when 'sigprocmask' fails.


From: Ludovic Courtès
Subject: [shepherd] 02/02: system: Throw an exception when 'sigprocmask' fails.
Date: Sat, 30 May 2020 13:38:02 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit 0ddd3a0c9169937f6274a1a25c63285e6c4e1abf
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat May 30 16:40:51 2020 +0200

    system: Throw an exception when 'sigprocmask' fails.
    
    * modules/shepherd/system.scm.in (sigprocmask): Check the result and
    call 'throw' upon error.
---
 modules/shepherd/system.scm.in | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/shepherd/system.scm.in b/modules/shepherd/system.scm.in
index 872fad4..ac822f8 100644
--- a/modules/shepherd/system.scm.in
+++ b/modules/shepherd/system.scm.in
@@ -187,7 +187,12 @@ number of the signal received."
     (lambda (how signals)
       "Add SIGNALS, a list of SIG* values, to the set of blocked signals if
 HOW is SIG_BLOCK, or unblock them if HOW is SIG_UNBLOCK."
-      (proc how (sigset signals) %null-pointer))))
+      (let-values (((result err)
+                    (proc how (sigset signals) %null-pointer)))
+        (if (= -1 result)
+            (throw 'system-error "sigprocmask" "~A"
+                   (list (strerror err)) (list err))
+            result)))))
 
 (define (block-signals signals)
   "Block SIGNALS, a list of SIG* values, in the current thread."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]