From: Taylor R Campbell Date: Tue, 13 Dec 2011 07:40:37 +0000 (+0000) Subject: Mark channel closed before interrupting in Unix's OS_channel_closed. X-Git-Tag: release-9.2.0~336^2 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=334b8d5be7a85155b1e904bbca4140a4a5f50f8a;p=mit-scheme.git Mark channel closed before interrupting in Unix's OS_channel_closed. Interruption may restart the primitive that called it, which will choke on a bad file descriptor. --- diff --git a/src/microcode/uxio.c b/src/microcode/uxio.c index 353620709..729f009f3 100644 --- a/src/microcode/uxio.c +++ b/src/microcode/uxio.c @@ -124,13 +124,14 @@ OS_channel_close (Tchannel channel) { if (! (CHANNEL_INTERNAL (channel))) { - if (0 > (UX_close (CHANNEL_DESCRIPTOR (channel)))) + int status = (UX_close (CHANNEL_DESCRIPTOR (channel))); + MARK_CHANNEL_CLOSED (channel); + if (status < 0) switch (errno) { case EINTR: deliver_pending_interrupts (); break; case EBADF: error_system_call (errno, syscall_close); break; } - MARK_CHANNEL_CLOSED (channel); } }