Michael Kerrisk (man-pages | 22 Apr 2012 09:18
Picon

Re: Error in the example of getaddrinfo

On Thu, Feb 3, 2011 at 10:39 PM, wimpunk
<wimpunk@...> wrote:
> Hi,
>
> I believe there is a bug in de client example code of getaddrinfo.  It
> is in the ubuntu 10.10 man pages (Version: 3.24-1ubuntu1) and also on
> http://www.kernel.org/doc/man-pages/online/pages/man3/getaddrinfo.3.html.
> The 'close(sfd);' will never happen and using the code in a loop, it
> will cause your system running out of filedescriptors (at least,
> that's what happened to me).  To use the code cleanly, you should code
> the sfd after the last printf.

Am I missing something? The close() will happen whenever bind() fails,
which is what is desired.

Cheers,

Michael

--

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane