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: Thu, 23 Oct 1997 12:55:54 -0400
Reply-to: Kevin Esler <esler@Rational.com>
If the connect fails inside socket-connect, two file descriptors are
leaked.

If you change the last few lines of socket-connect to read as follows,
the problem is solved:

    ;; Close the socket and free the file-descriptors
    ;; if the connect fails:
    ;;
    (dynamic-wind
     (lambda () #f)
     (lambda () (connect-socket sock addr))
     (lambda ()
       (close-socket sock)))
    sock))
-- 
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>