summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-04-12 16:26:00 +0200
committerLudovic Courtès <ludo@gnu.org>2017-04-13 00:12:42 +0200
commitbb5cad4eb2473889dd9938ab3d0453d30b0765e7 (patch)
tree950abd756d5337aeffa338ced0aa7ac866eb1593 /gnu
parent6ddf4fcfaeff8c9c1c6bd43c172ca33fe6d62c73 (diff)
downloadguix-bb5cad4eb2473889dd9938ab3d0453d30b0765e7.tar.gz
file-systems: Allow for bind-mounts of named sockets.
Previously a named socket such as /dev/log would fail
the 'regular-file?' test and we'd end up mkdir'ing it.

* gnu/build/file-systems.scm (regular-file?): Remove.
(mount-file-system): Change (regular-file? source)
to (not (file-is-directory? source)).
Diffstat (limited to 'gnu')
-rw-r--r--gnu/build/file-systems.scm8
1 files changed, 2 insertions, 6 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index eb9f07861f..0cb84b8aad 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -565,10 +565,6 @@ corresponds to the symbols listed in FLAGS."
       (()
        0))))
 
-(define (regular-file? file-name)
-  "Return #t if FILE-NAME is a regular file."
-  (eq? (stat:type (stat file-name)) 'regular))
-
 (define* (mount-file-system spec #:key (root "/root"))
   "Mount the file system described by SPEC under ROOT.  SPEC must have the
 form:
@@ -608,9 +604,9 @@ run a file system check."
          (check-file-system source type))
 
        ;; Create the mount point.  Most of the time this is a directory, but
-       ;; in the case of a bind mount, a regular file may be needed.
+       ;; in the case of a bind mount, a regular file or socket may be needed.
        (if (and (= MS_BIND (logand flags MS_BIND))
-                (regular-file? source))
+                (not (file-is-directory? source)))
            (unless (file-exists? mount-point)
              (mkdir-p (dirname mount-point))
              (call-with-output-file mount-point (const #t)))