Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Aug 1998 19:57:38 -0700 (PDT)
From:      Marc Slemko <marcs@znep.com>
To:        Phil Gilley <pgilley@metronet.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Stupidity or compiler bug?
Message-ID:  <Pine.GSO.4.02A.9808211956230.1186-100000@redfish>
In-Reply-To: <Pine.HPP.3.95.980821204532.12165B-100000@fohnix.metronet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 21 Aug 1998, Phil Gilley wrote:

> Am I doing something really stupid here or is this a compiler bug?
> The output of this program under 2.2.7-RELEASE is "1.2.3.4 1.2.3.4"
> which isn't what I was expecting.  "1.2.3.4 5.6.7.8" is what I was
> hoping for.
[...]
> 
> 	iph.ip_src.s_addr = ntohl(0x01020304);
> 	iph.ip_dst.s_addr = ntohl(0x05060708);
> 
> 	printf("%s %s\n", inet_ntoa(iph.ip_src), inet_ntoa(iph.ip_dst));

inet_ntoa uses static memory, so you can't call it multiple times without
doing something with the result in between calls.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.02A.9808211956230.1186-100000>