zlib: Fix memory leak due to revealed ports not being GC'd.
authorLudovic Courtès <ludo@gnu.org>
Wed, 11 Oct 2017 13:14:16 +0000 (15:14 +0200)
committerLudovic Courtès <ludo@gnu.org>
Wed, 11 Oct 2017 13:20:50 +0000 (15:20 +0200)
commit85a2b58987bc32e33e63bea86c1a94496b796ae9
treed79a3dc6c8ac09ee27cf15aa487258da1069c2b5
parent5781c7dd27b8d96cef2e54693ca3ac91f69b4bda
zlib: Fix memory leak due to revealed ports not being GC'd.

Fixes <https://bugs.gnu.org/28784>.

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.
guix/zlib.scm
tests/zlib.scm