This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/6545] struct ucred ifdefined behind __USE_GNU


------- Additional Comments From hyc at symas dot com  2008-06-03 18:56 -------
The ifdef is clearly wrong:

/* Socket level message types.  This must match the definitions in
   <linux/socket.h>.  */
enum
  {
    SCM_RIGHTS = 0x01           /* Transfer file descriptors.  */
#define SCM_RIGHTS SCM_RIGHTS
#ifdef __USE_BSD
    , SCM_CREDENTIALS = 0x02    /* Credentials passing.  */
# define SCM_CREDENTIALS SCM_CREDENTIALS
#endif
  };

#ifdef __USE_GNU
/* User visible structure for SCM_CREDENTIALS message */
struct ucred
{
  pid_t pid;                    /* PID of sending process.  */
  uid_t uid;                    /* UID of sending process.  */
  gid_t gid;                    /* GID of sending process.  */
};
#endif

The comment says the struct is used for the SCM_CREDENTIALS message. Therefore
it should at least be #ifdef __USE_BSD or #ifdef SCM_CREDENTIALS, not #ifdef
__USE_GNU.

Since the structure is also used by getsockopt(...SO_PEERCRED) it should probably be

#if defined(SO_PEERCRED) || defined(SCM_CREDENTIALS)

The comment should probably also be extended to indicate that it's also used for
the Linux-specific SO_PEERCRED sockopt.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


http://sourceware.org/bugzilla/show_bug.cgi?id=6545

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]