summaryrefslogtreecommitdiff
path: root/guix/nar.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-02-21 17:37:55 +0100
committerLudovic Courtès <ludo@gnu.org>2014-02-21 23:49:52 +0100
commita93e91ff484005e05491621664ab71f888ad2ba2 (patch)
treebc9e01f0b9bd52fc5c584f59e87b8ba78f6629cd /guix/nar.scm
parent86d07a5514d859772980ef87e39f6e2b668655c0 (diff)
downloadgnu-guix-a93e91ff484005e05491621664ab71f888ad2ba2.tar
gnu-guix-a93e91ff484005e05491621664ab71f888ad2ba2.tar.gz
nar: 'write-file' can write to non-file ports.
* guix/nar.scm (write-contents): Use 'sendfile' only when P is a file port. * tests/nar.scm ("write-file supports non-file output ports"): New test.
Diffstat (limited to 'guix/nar.scm')
-rw-r--r--guix/nar.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/guix/nar.scm b/guix/nar.scm
index 4bc2deb229..89a71302e0 100644
--- a/guix/nar.scm
+++ b/guix/nar.scm
@@ -112,7 +112,8 @@
(write-long-long size p)
(call-with-binary-input-file file
;; Use `sendfile' when available (Guile 2.0.8+).
- (if (compile-time-value (defined? 'sendfile))
+ (if (and (compile-time-value (defined? 'sendfile))
+ (file-port? p))
(cut sendfile p <> size 0)
(cut dump <> p size)))
(write-padding size p))