aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/bsd
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-05-23 19:43:09 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-05-23 19:43:09 +0200
commit3375cfafa7961c6ae0e509c31c3b3cef9ad1f03d (patch)
tree0c2ba750f8b7e15a6b826f9767fbb533bfb4f567 /sysdeps/unix/bsd
parentd912d3a1198dfa9acd59cb5a07e5ed27c910cb7f (diff)
downloadglibc-3375cfafa7961c6ae0e509c31c3b3cef9ad1f03d.tar
glibc-3375cfafa7961c6ae0e509c31c3b3cef9ad1f03d.tar.gz
glibc-3375cfafa7961c6ae0e509c31c3b3cef9ad1f03d.tar.bz2
glibc-3375cfafa7961c6ae0e509c31c3b3cef9ad1f03d.zip
Make padding in struct sockaddr_storage explicit [BZ #20111]
This avoids aliasing issues with GCC 6 in -fno-strict-aliasing mode. (With implicit padding, not all data is copied.) This change makes it explicit that struct sockaddr_storage is only 126 bytes large on m68k (unlike elsewhere, where we end up with the requested 128 bytes). The new test case makes sure that this does not happen on other architectures.
Diffstat (limited to 'sysdeps/unix/bsd')
-rw-r--r--sysdeps/unix/bsd/bits/sockaddr.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdeps/unix/bsd/bits/sockaddr.h b/sysdeps/unix/bsd/bits/sockaddr.h
index aa127689bf..f5900f9d73 100644
--- a/sysdeps/unix/bsd/bits/sockaddr.h
+++ b/sysdeps/unix/bsd/bits/sockaddr.h
@@ -1,4 +1,4 @@
-/* Definition of `struct sockaddr_*' common members. 4.4 BSD version.
+/* Definition of struct sockaddr_* common members and sizes, BSD version.
Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -39,4 +39,7 @@ typedef unsigned char sa_family_t;
#define _HAVE_SA_LEN 1 /* We have the sa_len field. */
+/* Size of struct sockaddr_storage. */
+#define _SS_SIZE 128
+
#endif /* bits/sockaddr.h */