Avoid duplicate closing of fds that correspond to ports.

This commit is contained in:
mainzelm 2001-10-03 17:09:15 +00:00
parent b537e81a35
commit b5190d9c71
1 changed files with 6 additions and 3 deletions

View File

@ -506,7 +506,9 @@
(define (evict-ports fd)
(cond ((maybe-fdes->port fd) => ; Shouldn't bump the revealed count.
(lambda (port)
(%move-fdport (%dup fd) port 0)))))
(%move-fdport (%dup fd) port 0)
#t))
(else #f)))
(define (%move-fdport fd port new-revealed)
(obtain-port-lock port)
@ -529,8 +531,9 @@
((if (input-port? port) make-input-fdchannel make-output-fdchannel) fd))
(define (close-fdes fd)
(evict-ports fd)
(%close-fdes fd))
(if (evict-ports fd)
#t ; EBADF should not occur if there is a port
(%close-fdes fd)))
(define (flush-fdport fdport)
(check-arg fdport? fdport flush-fdport)