secret-service: Fix file port leak in 'secret-service-send-secrets'.
authorLudovic Courtès <ludo@gnu.org>
Tue, 29 Sep 2020 07:35:35 +0000 (09:35 +0200)
committerLudovic Courtès <ludo@gnu.org>
Tue, 29 Sep 2020 19:56:27 +0000 (21:56 +0200)
* gnu/build/secret-service.scm (secret-service-send-secrets): Use
'call-with-input-file' instead of 'open-input-file'.

gnu/build/secret-service.scm

index 40c24ab..6697e6e 100644 (file)
@@ -69,8 +69,10 @@ local PORT.  If connect fails, sleep 1s and retry RETRY times."
                       (version 0)
                       (files ,files-sizes-modes))))
       (write secrets sock)
-      (for-each (compose (cute dump-port <> sock)
-                         (cute open-input-file <>))
+      (for-each (lambda (file)
+                  (call-with-input-file file
+                    (lambda (input)
+                      (dump-port input sock))))
                 files))))
 
 (define (secret-service-receive-secrets port)