[Xcb] [PATCH] Initialize all fields of addrinfo and use #ifdef

Barton C Massey bart at cs.pdx.edu
Thu Aug 28 21:38:43 PDT 2008

In message <20080828115818.GD28515 at patate.is-a-geek.org> you wrote:
> On Wed, Aug 27, 2008 at 09:34:40 -0700, Barton C Massey wrote:
> > The memset() here seems like it could potentially mask a
> > bug.  Initializing unknown extra fields to zero seems
> > scary---better to leave them uninitialized and hope the
> > compiler or valgrind can notice and warn. Am I missing
> > something?
> > 
> The getaddrinfo(3) manpage only documents the settings for ai_family,
> ai_socktype, ai_protocol and ai_flags, and says "All the other fields in
> the structure pointed to by hints must  contain either  0  or a null
> pointer, as appropriate".  The patch looks correct to me.

Wow, crazy.  I agree that your patch is correct, although I
can't imagine what possessed the library authors to do
that. :-)


More information about the Xcb mailing list