cURL / Mailing Lists / curl-library / Single Mail

curl-library

Ares: socklen_t problem

From: Tor Arntsen <tor_at_spacetec.no>
Date: Mon, 18 Feb 2013 20:32:54 +0100

c-ares commit cf7ad9758dd792 includes the following change to ares.h:

@@ -579,6 +579,12 @@ CARES_EXTERN int ares_set_servers_csv(ares_channel channel,
 CARES_EXTERN int ares_get_servers(ares_channel channel,
                                   struct ares_addr_node **servers);

+CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst,
+ socklen_t size);

socklen_t in a public header file is potentially problematic.. there
used to be one in <curl/curl.h> until 7.18 I think, but it got too
troublesome to maintain so it got removed. Now, the reason I noticed
is that libcurl autobuilds started to fail on Tru64.. see
http://curl.haxx.se/dev/log.cgi?id=20130218095816-18712
I'm not sure while it fails on Tru64 though, as it actually has
socklen_t (in <sys/socket.h> as long as e.g. _XOPEN_SOURCE is defined,
which I believe it is). socklen_t is 64 bits on Tru64. Anyway that
declaration fails. I'm not sure why, it's rather obscure:
cc -DHAVE_CONFIG_H -I. -I. -std1 -noansi_alias -warnprotos -msg_fatal
toofewargs,toomanyargs -g0 -O1 -c -MD ares__close_sockets.c -DPIC -o
.libs/libcares_la-ares__close_sockets.lo
cc: Error: ares.h, line 583: Ill-formed parameter type list. (parmtyplist)
                                        socklen_t size);
----------------------------------------^
Trivial tests with socklen_t compiles though.

Anyway, that's actually a side-track.. the problem is that
historically it has often turned out to be a bad idea to
unconditionally use socklen_t in a public header file.

-Tor
(p.s. I'm not on the c-ares mailing list)

CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-02-18