Subject: lib/12458: /usr/include/tcpd.h not c++ safe
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dmcmahill@netbsd.org>
List: netbsd-bugs
Date: 03/23/2001 11:53:03
>Number:         12458
>Category:       lib
>Synopsis:       /usr/include/tcpd.h not c++ safe
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 23 08:54:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dan McMahill (root)
>Release:        1.5<NetBSD-current source date>
>Organization:
	
>Environment:
	
System: NetBSD bondage 1.5 NetBSD 1.5 (GENERIC) #10: Wed Nov 22 03:00:56 PST 2000 root@frau-farbissina.shagadelic.org:/amd/swinger/u1/netbsd-1-5/src/sys/arch/alpha/compile/GENERIC alpha


>Description:

/usr/include/tcpd.h is not c++ safe 

it needs stuff like

#ifdef __cplusplus
extern "C" {
#endif

	
>How-To-Repeat:

cd /usr/pkgsrc/news/newscache && make
note:

/usr/build/pkgsrc/news/newscache/work.alpha/NewsCache-0.99.15/src/NewsCache.cc:1240: undefined reference to `hosts_ctl(char *, char *, char *, char *)'
/usr/build/pkgsrc/news/newscache/work.alpha/NewsCache-0.99.15/src/NewsCache.cc:1240: undefined reference to `hosts_ctl(char *, char *, char *, char *)'

but also note that hosts_ctl is in libwrap.

	
>Fix:
something like the following, but I'm not sure if this needs to surround
all prototypes or not.  I didn't commit anything myself as i wasn't totally
sure of what the right thing to do was.

--- /usr/include/tcpd.h.orig    Wed Nov 22 02:55:43 2000
+++ /usr/include/tcpd.h Fri Mar 23 11:13:59 2001
@@ -67,4 +67,7 @@
 
 /* Global functions. */
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
@@ -96,4 +99,7 @@
                __P((char *, unsigned long *));
 
+#ifdef __cplusplus  
+}           
+#endif 
 /* Global variables. */
 

	
>Release-Note:
>Audit-Trail:
>Unformatted: