Re: [PATCH 5/5] struct sockaddr_storage->ss_family is not portable
- From
Martin Storsjö <martin@martin.st>
- Date
- Mar 11, 2010, 16:40 UTC
- Message-ID
- <alpine.DEB.2.00.1003111838260.29993@cone.home.martin.st>
- In-Reply-To
- <20100311163715.GE7877@thor.il.thewrittenword.com>
On Thu, 11 Mar 2010, Gary V. Vaughan wrote:
> Many of our supported platforms do not have this declaration, for > example solaris2.6 thru 2.7. Lack of ss_family implies no IPV6 > support, so we can wrap all the ss_family references in an ifndef > NO_IPV6, and assume sockaddr_in otherwise.
While this probably is ok as such, you can actually do the same without accessing the sockaddr_storage->ss_family; just cast it to (const struct sockaddr*) and use ->sa_family instead, that should work just as well, as far as I know.
// Martin