deduplicate: Use 'sendfile' only with file ports.

Fixes a regression introduced in b129026e2e.

* guix/store/deduplication.scm (dump-file/deduplicate): Use 'sendfile'
only when INPUT' is a file port.
This commit is contained in:
Ludovic Courtès 2022-12-10 18:12:59 +01:00
parent 61b7e96877
commit 7866294e32
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 4 additions and 1 deletions

View File

@ -262,7 +262,10 @@ down the road."
(deduplicate file (dump-and-compute-hash) #:store store)
(call-with-output-file file
(lambda (output)
(sendfile output input size 0)))))
(if (file-port? input)
(sendfile output input size 0)
(dump-port input output size
#:buffer-size %deduplication-minimum-size))))))
(define* (copy-file/deduplicate source target
#:key (store (%store-directory)))