Re: Error in the example of getaddrinfo

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

 



On Thu, Feb 3, 2011 at 10:39 PM, wimpunk <wimpunk@xxxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux