summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--guix/build/utils.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index a3050b955c..c480dbf8a6 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -122,7 +122,13 @@ with the bytes in HEADER, a bytevector."
           (get-bytevector-n port len))
         #:binary #t #:guess-encoding #f))
 
-    (equal? (get-header) header)))
+    (catch 'system-error
+      (lambda ()
+        (equal? (get-header) header))
+      (lambda args
+        (if (= EISDIR (system-error-errno args))
+            #f                                    ;FILE is a directory
+            (apply throw args))))))
 
 (define %elf-magic-bytes
   ;; Magic bytes of ELF files.  See <elf.h>.