Bug 53984 - /usr/include/bits/socket.h struct cmsghdr broken
Summary: /usr/include/bits/socket.h struct cmsghdr broken
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc   
(Show other bugs)
Version: 7.1
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Aaron Brown
URL: http://www.osl.iu.edu/~brbarret/redhat/
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-09-24 22:28 UTC by Brian Barrett
Modified: 2016-11-24 14:49 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-09-25 09:39:53 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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 04:00:00 UTC

Description Brian Barrett 2001-09-24 22:28:51 UTC
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 09:39:48 UTC
Agreed, see http://sources.redhat.com/ml/libc-hacker/2001-09/msg00075.html

Comment 2 Jakub Jelinek 2001-10-17 16:00:20 UTC
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.