summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-09-26 22:30:16 +0200
committerLudovic Courtès <ludo@gnu.org>2018-09-26 23:40:36 +0200
commit6f03b08089167ec863361352ab200830bffeb0b7 (patch)
tree77f603526c508da7219d9018af6ebcaff33079c4 /gnu/services
parent2a5f2b1f7550db701172a338e98179e1cac55a1c (diff)
downloadguix-6f03b08089167ec863361352ab200830bffeb0b7.tar.gz
services: dhcp-client: Use 'read-pid-file'.
* gnu/services/networking.scm (dhcp-client-service-type)[start]: Use
'read-pid-file' instead of the custom and possibly infinite loop.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/networking.scm16
1 files changed, 2 insertions, 14 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index bd1d5a2706..3fdb2bb9f7 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016, 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
@@ -191,19 +191,7 @@ fe80::1%lo0 apps.facebook.com\n")
                              (cons* #$dhclient "-nw"
                                     "-pf" #$pid-file ifaces))))
                    (and (zero? (cdr (waitpid pid)))
-                        (let loop ()
-                          (catch 'system-error
-                            (lambda ()
-                              (call-with-input-file #$pid-file read))
-                            (lambda args
-                              ;; 'dhclient' returned before PID-FILE was created,
-                              ;; so try again.
-                              (let ((errno (system-error-errno args)))
-                                (if (= ENOENT errno)
-                                    (begin
-                                      (sleep 1)
-                                      (loop))
-                                    (apply throw args))))))))))
+                        (read-pid-file #$pid-file)))))
       (stop #~(make-kill-destructor))))))
 
 (define* (dhcp-client-service #:key (dhcp isc-dhcp))