From 85a2b58987bc32e33e63bea86c1a94496b796ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 11 Oct 2017 15:14:16 +0200 Subject: zlib: Fix memory leak due to revealed ports not being GC'd. Fixes . This mostly reverts 81a0f1cdf12e7bcc34c1203f034a323fa8f52cf5, which introduced a regression: revealed ports are *never* GC'd (contrary to what Guile's manual suggests). In addition to the revert, 'close-procedure' now explicitly swallows EBADF errors when 'close-port' is called. * guix/zlib.scm (close-procedure): New procedure. (make-gzip-input-port)[gzfile]: Use 'fileno' instead of 'port->fdes'. Use 'close-procedure' instead of 'gzclose'. (make-gzip-output-port): Likewise. * tests/zlib.scm ("compression/decompression pipe"): Use 'port-closed?' to determine whether PARENT has been closed. --- tests/zlib.scm | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'tests/zlib.scm') diff --git a/tests/zlib.scm b/tests/zlib.scm index f71609b7c5..5455240a71 100644 --- a/tests/zlib.scm +++ b/tests/zlib.scm @@ -57,16 +57,7 @@ (match (waitpid pid) ((_ . status) (and (zero? status) - - ;; PORT itself isn't closed but its underlying file - ;; descriptor must have been closed by 'gzclose'. - (catch 'system-error - (lambda () - (seek (fileno parent) 0 SEEK_CUR) - #f) - (lambda args - (= EBADF (system-error-errno args)))) - + (port-closed? parent) (bytevector=? received data)))))))))))) (test-end) -- cgit v1.2.3