From Bugzilla Helper:
User-Agent: Mozilla/4.78 [en] (X11; U; SunOS 5.8 sun4u)
Description of problem:
On Red Hat 7.1, the struct cmsghdr defined in /usr/include/bits/socket.h is
broken when used with non-gcc compilers. The size of the struct is
different on non-gcc compilers than on gcc compilers, so any code compiled
with non-gcc compilers and linked with the glibc rpm package will fail.
This is true even if the CMSG_DATA macro is used.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Download the broken_cmsghdr.c from the URL above
2. Compile with gcc; run the exectuable. Notice that it works.
3. Compile with something other than gcc (e.g., Portland Group compilers,
pgcc), and notice that it doesn't work.
4. Long comments in the sample .c file explain the problem.
The problem is actually in /usr/include/bits/socket.h, because a member in
the struct cmsghdr is not protected properly for non-gcc compilers. Here's
a quick patch to fix /usr/include/bits/socket.h (other linux distros do
--- socket.h Mon Sep 24 17:26:48 2001
+++ /usr/include/bits/socket.h Mon Sep 24 15:42:27 2001
@@ -227,10 +227,8 @@
of cmsghdr structure. */
int cmsg_level; /* Originating protocol. */
int cmsg_type; /* Protocol specific type. */
-#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
__extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.
/* XXX Perhaps this should be removed. */
/* Ancillary data object manipulation macros. */
Agreed, see http://sources.redhat.com/ml/libc-hacker/2001-09/msg00075.html
Should be fixed in glibc-2.2.4-19.