This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/20111] struct sockaddr_storage cannot be aggregate-copied
- From: "fweimer at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 18 May 2016 02:31:23 +0000
- Subject: [Bug libc/20111] struct sockaddr_storage cannot be aggregate-copied
- Auto-submitted: auto-generated
- References: <bug-20111-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=20111
--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to rguenther from comment #2)
> Making the struct incomplete would do the trick and force heap
> allocation (or allocation via alloca). But I guess that would break
> too much code out in the wild.
This is totally impractical, the type is part of the ABI.
In general. there is an expectation that you can use struct sockaddr_storage as
some sort of generic socket address. POSIX also requires that it has a
positive size and sufficient alignment (so that you can store a copy of struct
sockaddr_un in it). This does not necessarily mean that objects of struct
sockaddr_storage can be copied with an aggregate copy.
POSIX also requires that the ss_family member of struct sockaddr_storage and
the sun_family member of struct sockaddr_un can alias, and there is currently
no way to tell GCC that (there is in standard C, using a declaration of a union
that has both structs as members).
--
You are receiving this mail because:
You are on the CC list for the bug.