Re: [gnet-devel] gnet_unix_socket_new file descriptor leak?



On Wed, 2007-03-28 at 12:01 -0700, JF wrote:

Hi,

> I am currently looking at gnet_unix_socket_new for version 2.0.7.  In
> this function, if connect fails, should the socket (s->sockfd) be
> closed?  Otherwise, the socket created will not be closed.

You're right, but I think this was fixed a while ago in SVN trunk by
this commit (see last paragraph):

 2007-02-01  Tim-Philipp Müller  <tim at centricular dot net>

        Based on patch by: Zeeshan Ali  <zeenix at gmail.com>

        * NEWS:
        * src/unix.c: (gnet_unix_socket_new),
          (gnet_unix_socket_server_new):
          Pass SUN_LEN (struct sockaddr_un) as size parameter
          to bind() and connect() rather than just
          sizeof (struct sockaddr_un); apparently this matters
          in some environments (yay for great APIs; also yay
          for wrong man pages). Fixes #403197.
          Also do a bunch of small clean-ups, and don't leak
          memory/sockets in some failure cases.

(yes, I really should be making a release one of these days).

 Cheers
  -Tim





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]