summary refs log tree commit diff
path: root/gnu/services/base.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-09-02 15:57:56 +0200
committerMarius Bakke <mbakke@fastmail.com>2017-09-02 15:57:56 +0200
commit30dfac27a5642c36e7bb1ba7966566864ba2d28d (patch)
tree3b59623014eeea1df02cda5f926d803b9a36a828 /gnu/services/base.scm
parentd2ee294c0400ac8f2a10f10c3c9644da513a3712 (diff)
parent65e4109cdc96fbaee088f50d0138af8acef43141 (diff)
downloadguix-30dfac27a5642c36e7bb1ba7966566864ba2d28d.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'gnu/services/base.scm')
-rw-r--r--gnu/services/base.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 54bd9ca2fb..5001298ab3 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -456,6 +456,19 @@ in KNOWN-MOUNT-POINTS when it is stopped."
                       (delete-file #$%do-not-kill-file)))
 
                 (let wait ()
+                  ;; Reap children, if any, so that we don't end up with
+                  ;; zombies and enter an infinite loop.
+                  (let reap-children ()
+                    (define result
+                      (false-if-exception
+                       (waitpid WAIT_ANY (if (null? omitted-pids)
+                                             0
+                                             WNOHANG))))
+
+                    (when (and (pair? result)
+                               (not (zero? (car result))))
+                      (reap-children)))
+
                   (let ((pids (processes)))
                     (unless (lset= = pids (cons 1 omitted-pids))
                       (format #t "waiting for process termination\