Fix missing port-table locking and bytevector output port segfault
authorAndreas Rottmann <a.rottmann@gmx.at>
Sat, 20 Nov 2010 17:40:30 +0000 (18:40 +0100)
committerLudovic Courtès <ludo@gnu.org>
Sat, 20 Nov 2010 22:55:19 +0000 (23:55 +0100)
commita653d32a8d02c90a426232de5b432e60fc33c1da
tree1e8e93b3dd04bfccd68217949ea268710b492dd2
parent8fdd85f834aa1e0ed76542cdc8ce63d323dc6c1e
Fix missing port-table locking and bytevector output port segfault

* libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop): Lock
  the port table.

* libguile/r6rs-ports.c (make_bop): Let the returned extraction
  procedure refer to the port's buffer instead of the port itself.  This
  fixes a segfault if the port is closed before the extraction procedure
  is called.
  (bop_proc_apply): Adapt accordingly.
* test-suite/tests/r6rs-ports.test (8.2.10 Output ports): Add testcase
  for extraction after close.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
libguile/r6rs-ports.c
test-suite/tests/r6rs-ports.test