From a93e91ff484005e05491621664ab71f888ad2ba2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 21 Feb 2014 17:37:55 +0100 Subject: 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. --- guix/nar.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'guix') 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 @@ (define (call-with-binary-input-file file proc) (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)) -- cgit v1.2.3