On Sun, Apr 11, 2010 at 01:43:11PM -0700, patrick keshishian wrote: > On Sun, Apr 11, 2010 at 09:40:45PM +0200, Toni Mueller wrote: > > Hi Patrick, > > > > On Sun, 11.04.2010 at 11:58:54 -0700, patrick keshishian > > <sids...@boxsoft.com> wrote: > > > inet_ntoa will return pointer to a static buffer. Each call > > > TO IT Will override thsi buffer with the new IP info. > > > > I already suspected something like this, but this behaviour is not > > documented in the man page. > > Look at the very bottom of the man page:
$ man 9 inet_ntoa man: no entry for inet_ntoa in section 9 of the manual. And, just in case that's not enough illumination: $ cd /usr/src/sys/ $ grep -nsIR ^inet_ntoa * arch/amd64/stand/pxeboot/net.c:220:inet_ntoa(struct in_addr ia) arch/i386/stand/pxeboot/net.c:220:inet_ntoa(struct in_addr ia) lib/libsa/net.c:402:inet_ntoa(struct in_addr ia) netinet/ip_input.c:147:inet_ntoa(ina) netinet/ip_ipsp.c:962:inet_ntoa4(struct in_addr ina) > > The string returned by inet_ntoa() resides in a static > memory area > > --patrick