Bug 53984 - /usr/include/bits/socket.h struct cmsghdr broken
/usr/include/bits/socket.h struct cmsghdr broken
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
7.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
http://www.osl.iu.edu/~brbarret/redhat/
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-09-24 18:28 EDT by Brian Barrett
Modified: 2007-04-18 12:37 EDT (History)
0 users

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


Attachments (Terms of Use)

  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:
Always

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
this):

--- 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.  */
-#endif
   };
 
 /* 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.