scsh-users
[Top] [All Lists]

socket-connect leaks file descriptors

To: scsh-bugs@martigny.ai.mit.edu
Subject: socket-connect leaks file descriptors
From: Kevin Esler <esler@Rational.com>
Date: Fri, 24 Oct 1997 10:49:11 -0400
Reply-to: Kevin Esler <esler@Rational.com>
Thanks to Rob Warnock for pointing out the obvious bugs in my bugfix.
This is more like it:

Change the last few lines of socket-connect to read as follows:

    ;; Close the socket and free the file-descriptors
    ;; if the connect fails:
    ;;
    (let ((connected #f))
      (dynamic-wind
       (lambda () #f)
       (lambda () (connect-socket sock addr) (set! connected #t))
       (lambda ()
         (if (not connected)
             (close-socket sock))))
      (if connected
          sock
          #f))))

-- 
Kevin Esler                 Rational Software
                            20 Maguire Road
Tel: (617) 676-2626         Lexington, MA 02173-3104
Fax: (617) 676-2600
mailto:esler@Rational.com  WWW: http://www.Rational.com/

<Prev in Thread] Current Thread [Next in Thread>