tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: struct sockaddr_storage issues



>> (You have to either clear the unused [struct addrinfo] fields by
>> assignment, which ignores future-proofing in that it hardwires the
>> set of fields being cleared, or you have to use bzero or moral
>> equivalent, which ignores the nonportability of assuming all-0-bits
>> is a nil pointer.)
>   struct addrinfo hint = { 0 };
>   hint.ai_flags = ...;

Doh!  Of course.

Yes, that's correct and elegant.  I don't know why I hadn't thought of
it in all the years I've been using getaddrinfo.  Perhaps because I
don't use initializers with auto variables, and my hints variables are
normally auto?  Except I've done the analog with at least one other
struct (struct selinfo), so that alone does not explain.  Some kind of
unaccountable blind spot, at any rate.

Thank you very much!

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index