lists.arthurdejong.org
RSS feed

Minor portability fix for cvsd 1.0.22

[Date Prev][Date Next] [Thread Prev][Thread Next]

Minor portability fix for cvsd 1.0.22



I recently updated the NetBSD pkgsrc version of cvsd to 1.0.22.

In the process of doing so, I discovered one portability issue.
The use of AI_ADDRCONFIG is not supported by all platforms. (at
the moment, I strongly suspect it is a Linux-only feature.)

The attached patch handles the use of AI_ADDRCONFIG in a
portable, minimally intrusive fashion.

Thank you,
        Eric Schnoebelen

--
Eric Schnoebelen                eric@cirr.com           http://www.cirr.com
        "Bureaucrats are inflicted upon us by God, so that we will look 
                forward to dying." -- G. Gordon Liddy
$NetBSD: patch-ae,v 1.1 2011/10/03 23:45:27 schnoebe Exp $

Conditionally use AI_ADDRCONFIG, it doesn't exist on all platforms.

--- cfg.c.orig  2010-08-26 20:21:25.000000000 +0000
+++ cfg.c
@@ -122,7 +122,10 @@ void cfg_addaddress(struct cvsd_cfg *cfg
 
   /* create the name for the socket */
   memset(&hints,0,sizeof(struct addrinfo));
-  hints.ai_flags=AI_PASSIVE|AI_ADDRCONFIG;
+  hints.ai_flags=AI_PASSIVE;
+#if defined(AI_ADDRCONFIG)     /* a linux-ism */
+  hints.ai_flags|=AI_ADDRCONFIG;
+#endif
   hints.ai_family=PF_UNSPEC;
   hints.ai_socktype=SOCK_STREAM;
   switch (i=getaddrinfo(node,service,&hints,&(addr->addrs)))
-- 
To unsubscribe send an email to
cvsd-users-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/cvsd-users/