[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: http://bugs.kde.org/db/19/19124.html
From:       Thiago Macieira <thiagom () mail ! com>
Date:       2001-01-29 23:40:12
[Download RAW message or body]

Stephan Kulow wrote:
>
> Hi!
>
> The above is a compilation problem with kdesu on RH 5.2
> Does someone have an idea about ancient systems? :)

Hi!

I have done a superficial check on glibc's header files and in
kdelibs/kdesu/client.cpp. The compilation problem is caused by the
fact that structure "struct ucred" wasn't ever defined. Please ignore
the "cmsg_data" warning. That's glibc's fault, not KDE's.

The code in kdelibs/kdesu/client.cpp using ucred is wrapped around an
#ifdef for SO_PEERCRED (Peer credentials, I take it). Unfortunately,
even though glibc 2.1.3 I have defines "struct ucred" in
bits/socket.h, it is never mentioned in the documentation, so I don't
know how standard it is.

Anyways, the problem is because bits/socket.h includes asm/socket.h
(in Linux, at least), which defines SO_PEERCRED, but not struct ucred,
which is defined in linux/socket.h. So, since changing glibc is out of
the question for KDE :->, here's the solution I propose (sorry, no
patch and no test now):

- in the configure script, add a check for "struct ucred" in
sys/socket.h, which is where we expect that to be. It's just a simple
AC_TRY_COMPILE and AC_DEFINE(HAVE_STRUCT_UCRED)
- in kdelibs/kdesu/client.cpp, change the #ifndef SO_PEERCRED to:
#if !defined(SO_PEERCRED) || !defined(HAVE_STRUCT_UCRED)

==== for kdelibs/configure.in.in:
AC_SUBST(HAVE_STRUCT_UCRED)
AC_MSG_CHECKING([for struct ucred])
AC_TRY_COMPILE(
  [
    #include <sys/socket.h>
    struct ucred cred;
  ],
  [ ],
  [
    AC_DEFINE(HAVE_STRUCT_UCRED,1,[Define if struct ucred is present
from sys/socket.h])
    AC_MSG_RESULT(yes)
  ],
  AC_MSG_RESULT(no)
)
====
--
  Thiago Macieira - UFOT Registry number: 1001
 thiagom@mail.com talha@geocities.com
   ICQ UIN: 1967141  PGP: 0x8F2978D5 and 0xEA9037A5
     Registered Linux user #65028

102/380. You have achieved in disgrace what I always wanted to be. --
Lt. Cmdr. Data, "Deja Q"

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic