better handling for exceptions in close-port and port finalizers
authorAndy Wingo <wingo@pobox.com>
Tue, 14 Feb 2012 13:33:19 +0000 (14:33 +0100)
committerAndy Wingo <wingo@pobox.com>
Tue, 14 Feb 2012 21:47:26 +0000 (22:47 +0100)
commit5a771d5f514134c7cc3f03c9662f55950d7b8275
tree464ae969d4efe373257241441f6f05bfb9e3bd18
parent098818a165bea6cbfee8f56a833bc2e48e4f30b0
better handling for exceptions in close-port and port finalizers

* libguile/fports.c (close_the_fd, fport_close): Arrange to always close
  the fd, even if the flush procedure throws an exception.  Perhaps the
  port machinery should do this for us, though.  Don't wrap the close
  call in SCM_SYSCALL, EINTR leaves the fd in an unspecified state.
  Don't bother freeing buffers, the collector will handle that; simply
  drop references via scm_port_non_buffer.

* libguile/ports.c (do_free, finalize_port): Catch exceptions caused by
  the free procedure.  Don't bother setting the stream to 0 at all.
  (scm_close_port): Ensure that exceptions thrown by the "close"
  procedure don't prevent the port from being marked as closed.
libguile/fports.c
libguile/ports.c