netdev
[Top] [All Lists]

ANSI C++ problem in include/linux/socket.h

To: netdev@xxxxxxxxxxxxxxx
Subject: ANSI C++ problem in include/linux/socket.h
From: OKUJI Yoshinori <okuji@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 08 Nov 1999 07:22:59 +0900
Sender: owner-netdev@xxxxxxxxxxx
  Hello,

  When compiling lftp with gcc-2.95.2 on linux-2.2.13, I got this
error:

gcc -DHAVE_CONFIG_H -I. -I. -I../include -I../include    -O2 -Wall 
-Wwrite-strings -Woverloaded-virtual -fno-exceptions -fno-rtti -c -o ftpclass.o 
ftpclass.cc
In file included from /usr/include/sys/socket.h:6,
                 from ftpclass.cc:26:
/usr/include/linux/socket.h: In function `struct cmsghdr * __cmsg_nxthdr(void 
*, unsigned int, cmsghdr *)':
/usr/include/linux/socket.h:109: ANSI C++ forbids implicit conversion from 
`void *' in return


This incompatibility could be fixed just by this patch below. The
change should be trivial.


--- linux/include/linux/socket.h        Tue Aug 10 04:05:13 1999
+++ /usr/src/linux/include/linux/socket.h       Mon Nov  8 07:07:24 1999
@@ -106,7 +106,7 @@
 
        __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) +  
CMSG_ALIGN(__cmsg->cmsg_len));
        if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
-               return NULL;
+               return (struct cmsghdr *) NULL;
 
        return __ptr;
 }


Best wishes,
okuji
----------------------------------------------------------------------
OKUJI Yoshinori  <okuji@xxxxxxxxxxxxxxxxxxx>           ^o-o^
http://duff.kuicr.kyoto-u.ac.jp/~okuji (in English)     m /

<Prev in Thread] Current Thread [Next in Thread>