Re: connect.c compilation problems on irix

2003-12-01 Thread Dražen Kačar
Hrvoje Niksic wrote:

 access to structure elements *looks* like it's accessing an sa_len
 element, whereas in fact it's in fact accessing a union.  This is all
 very nice until you try to name a variable sa_len.

That's why dear standards reserve large chunks of the namespace. Something
or other posixoid in nature probably reserves all identifiers starting
with sa_ in case you include a certain header file.

And in case you defined identifiers ending with _t while including
sys/types.h, you're violating the scriptures. :-)

-- 
 .-.   .-.Yes, I am an agent of Satan, but my duties are largely
(_  \ /  _)   ceremonial.
 |
 |[EMAIL PROTECTED]


Re: connect.c compilation problems on irix

2003-11-27 Thread Hrvoje Niksic
Dan Staines [EMAIL PROTECTED] writes:

 A little digging reveals that the preprocessor is replacing the
 token sa_len with sa_union . sa_generic . sa_len2

Adorable.  :-)

 However, I can't find a macro (or even another mention!) for sa_len
 defined anywhere, so presume it must be some strange combination of
 preprocessor directives on irix (I'm not an expert in this kind of
 thing, though). In any case, modifying connect.c to use a name other
 than sa_len fixes it so everything compiles, but obviously it would
 be much better to find the real cause of the problem:

You found the real cause all right.  The IRIX header files define
sa_len (a member in a structure, I forget which one) to a macro, so
access to structure elements *looks* like it's accessing an sa_len
element, whereas in fact it's in fact accessing a union.  This is all
very nice until you try to name a variable sa_len.

Here's a fix, against the current CVS.  (I applied a similar fix to
the 1.9 branch as well.)  Thanks for the report.


2003-11-27  Hrvoje Niksic  [EMAIL PROTECTED]

* connect.c (bind_local): Rename sa_len to addrlen because IRIX
headers define sa_len as a macro.

Index: src/connect.c
===
RCS file: /pack/anoncvs/wget/src/connect.c,v
retrieving revision 1.60
diff -u -r1.60 connect.c
--- src/connect.c   2003/11/26 17:20:23 1.60
+++ src/connect.c   2003/11/27 10:56:48
@@ -447,8 +447,8 @@
   /* If *PORT is 0, find out which port we've bound to.  */
   if (*port == 0)
 {
-  socklen_t sa_len = sockaddr_size (sa);
-  if (getsockname (sock, sa, sa_len)  0)
+  socklen_t addrlen = sockaddr_size (sa);
+  if (getsockname (sock, sa, addrlen)  0)
{
  /* If we can't find out the socket's local address (name),
 something is seriously wrong with the socket, and it's