diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-01-01 22:07:42 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-01-01 22:11:13 +0100 |
commit | cf13f740a91b5bbf6bb60a30b45c2a3933ff1259 (patch) | |
tree | 9a8e68c0bde75f36439eaf4740c0fba45f9f1a35 /sysdeps | |
parent | 6e177ca635f5879eb35573f3c199b1c14e978ab7 (diff) | |
download | glibc-cf13f740a91b5bbf6bb60a30b45c2a3933ff1259.zip glibc-cf13f740a91b5bbf6bb60a30b45c2a3933ff1259.tar.gz glibc-cf13f740a91b5bbf6bb60a30b45c2a3933ff1259.tar.bz2 |
bits/socket.h: Update to recent BSD definition
The old BSD 4.4 definition (not used by Linux) was not 64b-proof: the
cmsg_data field is supposed to CMSG_ALIGN'ed (as can be also seen in the
CMSG_LEN macro).
Suggested-by: Diego Nieto Cid <dnietoc@gmail.com>
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/mach/hurd/bits/socket.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index 01af802..8c18cef 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -228,17 +228,13 @@ struct cmsghdr of cmsghdr structure. */ int cmsg_level; /* Originating protocol. */ int cmsg_type; /* Protocol specific type. */ -#if __glibc_c99_flexarr_available - __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */ -#endif + /* This field is to be aligned with CMSG_ALIGN */ + /* __extension__ unsigned char __cmsg_data __flexarr; */ /* Ancillary data. */ }; /* Ancillary data object manipulation macros. */ -#if __glibc_c99_flexarr_available -# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) -#else -# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) -#endif +#define CMSG_DATA(cmsg) \ + ((unsigned char *) (cmsg) + CMSG_ALIGN (sizeof (struct cmsghdr))) #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) |