[Python-Dev] Re: Problems with socketmodule (getnameinfo & getaddrinfo)

Mark Favas m.favas@per.dem.csiro.au
Tue, 26 Jun 2001 03:38:47 +0800


"Martin v. Loewis" wrote:
> 
> > To get socketmodule.c to compile, I had to make a change to line 2963
> > so that the declaration of inet_pton matched the previous declaration on
> > line 220 (changing char *src to const char *src). Still have problems
> > though, due to the use of snprintf in getnameinfo.c:
> 
> Ok, they are printing a single number into a 512 byte buffer; that is
> safe even with sprintf only, so I have just remove the snprintf call.
> Can you please try again?
> 
> Thanks for your reports,
> Martin

No trouble... The current CVS compiles (with a warning), links, and
runs. The warning given is:

cc: Warning:
/home/gonzo1/mark/groucho1/mark/src/python/CVS/python/dist/src/Modu
les/getaddrinfo.c, line 407: In this statement, the referenced type of
the point
er value "hostname" is const, but the referenced type of the target of
this assi
gnment is not. (notconstqual)
                if (inet_pton(gai_afdl[i].a_af, hostname, pton)) {
------------------------------------------------^

which can be fixed by declaring the second argument to inet_pton as
const char* instead of char* in the two occurences of inet_pton in
socketmodule.c

Cheers,
	Mark
-- 
Mark Favas  -   m.favas@per.dem.csiro.au
CSIRO, Private Bag No 5, Wembley, Western Australia 6913, AUSTRALIA