Bug 53984 - /usr/include/bits/socket.h struct cmsghdr broken
/usr/include/bits/socket.h struct cmsghdr broken
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
Depends On:
  Show dependency treegraph
Reported: 2001-09-24 18:28 EDT by Brian Barrett
Modified: 2016-11-24 09:49 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-09-25 05:39:53 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2001:121 normal SHIPPED_LIVE GNU C Library bugfix update 2001-10-04 00:00:00 EDT

  None (edit)
Description Brian Barrett 2001-09-24 18:28:51 EDT
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):

How reproducible:

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.

Additional info:

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.  */
Comment 1 Jakub Jelinek 2001-09-25 05:39:48 EDT
Agreed, see http://sources.redhat.com/ml/libc-hacker/2001-09/msg00075.html
Comment 2 Jakub Jelinek 2001-10-17 12:00:20 EDT
Should be fixed in glibc-2.2.4-19.

Note You need to log in before you can comment on or make changes to this bug.