From 3375cfafa7961c6ae0e509c31c3b3cef9ad1f03d Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 23 May 2016 19:43:09 +0200 Subject: 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. --- bits/sockaddr.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bits/sockaddr.h') diff --git a/bits/sockaddr.h b/bits/sockaddr.h index e91f837..0af58c9 100644 --- a/bits/sockaddr.h +++ b/bits/sockaddr.h @@ -1,4 +1,4 @@ -/* Definition of `struct sockaddr_*' common members. Generic/4.2 BSD version. +/* Definition of struct sockaddr_* common members and sizes, generic version. Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -36,4 +36,7 @@ typedef unsigned short int sa_family_t; #define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int)) +/* Size of struct sockaddr_storage. */ +#define _SS_SIZE 128 + #endif /* bits/sockaddr.h */ -- cgit v1.1