Avoid duplicate closing of fds that correspond to ports.
This commit is contained in:
parent
b537e81a35
commit
b5190d9c71
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue