summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-05-08 15:07:52 +0200
committerLudovic Courtès <ludo@gnu.org>2017-05-08 16:29:23 +0200
commitc298fb133acbdc17e05a79c10ab9a9e214368264 (patch)
tree20776215a4bf0b4c457135c2a89b4412db683729
parentddce2d3aaea804604a32e6c4b70d78e6cc033df3 (diff)
downloadguix-c298fb133acbdc17e05a79c10ab9a9e214368264.tar.gz
services: nscd: Adjust activation snippet for /etc/resolv.conf symlinks.
Fixes <http://bugs.gnu.org/26809>.
Reported by Mark H Weaver <mhw@netris.org>.

* gnu/services/base.scm (nscd-activation): Use 'lstat' instead of
'file-exists?'.
-rw-r--r--gnu/services/base.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index a64faa0d18..c244174fd3 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1152,8 +1152,10 @@ the tty to run, among other things."
       (mkdir-p "/var/db/nscd")                    ;for the persistent cache
 
       ;; In libc 2.25 nscd uses inotify to watch /etc/resolv.conf, but only if
-      ;; that file exists when it is started.  Thus create it here.
-      (unless (file-exists? "/etc/resolv.conf")
+      ;; that file exists when it is started.  Thus create it here.  Note: on
+      ;; some systems, such as when NetworkManager is used, /etc/resolv.conf
+      ;; is a symlink, hence 'lstat'.
+      (unless (false-if-exception (lstat "/etc/resolv.conf"))
         (call-with-output-file "/etc/resolv.conf"
           (lambda (port)
             (display "# This is a placeholder.\n" port))))))