Explorar o código

ZOOKEEPER-1323. c client doesn't compile on freebsd (michi mutsuzaki via phunt)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1214537 13f79535-47bb-0310-9956-ffa450edef68
Patrick D. Hunt %!s(int64=13) %!d(string=hai) anos
pai
achega
7a5a599016
Modificáronse 2 ficheiros con 10 adicións e 1 borrados
  1. 3 0
      CHANGES.txt
  2. 7 1
      src/c/src/zookeeper.c

+ 3 - 0
CHANGES.txt

@@ -78,6 +78,9 @@ BUGFIXES:
   (phunt and breed via mahadev)
   (phunt and breed via mahadev)
 
 
   ZOOKEEPER-1269. Multi deserialization issues. (Camille Fournier via mahadev)
   ZOOKEEPER-1269. Multi deserialization issues. (Camille Fournier via mahadev)
+
+  ZOOKEEPER-1323. c client doesn't compile on freebsd
+  (michi mutsuzaki via phunt)
  
  
 IMPROVEMENTS:
 IMPROVEMENTS:
 
 

+ 7 - 1
src/c/src/zookeeper.c

@@ -442,7 +442,8 @@ static void setup_random()
 static int getaddrinfo_errno(int rc) { 
 static int getaddrinfo_errno(int rc) { 
     switch(rc) {
     switch(rc) {
     case EAI_NONAME:
     case EAI_NONAME:
-#if EAI_NODATA != EAI_NONAME
+// ZOOKEEPER-1323 EAI_NODATA and EAI_ADDRFAMILY are deprecated in FreeBSD.
+#if defined EAI_NODATA && EAI_NODATA != EAI_NONAME
     case EAI_NODATA:
     case EAI_NODATA:
 #endif
 #endif
         return ENOENT;
         return ENOENT;
@@ -578,7 +579,12 @@ int getaddrs(zhandle_t *zh)
             // ai_flags as AI_ADDRCONFIG
             // ai_flags as AI_ADDRCONFIG
 #ifdef AI_ADDRCONFIG
 #ifdef AI_ADDRCONFIG
             if ((hints.ai_flags == AI_ADDRCONFIG) && 
             if ((hints.ai_flags == AI_ADDRCONFIG) && 
+// ZOOKEEPER-1323 EAI_NODATA and EAI_ADDRFAMILY are deprecated in FreeBSD.
+#ifdef EAI_ADDRFAMILY
                 ((rc ==EAI_BADFLAGS) || (rc == EAI_ADDRFAMILY))) {
                 ((rc ==EAI_BADFLAGS) || (rc == EAI_ADDRFAMILY))) {
+#else
+                (rc == EAI_BADFLAGS)) {
+#endif
                 //reset ai_flags to null
                 //reset ai_flags to null
                 hints.ai_flags = 0;
                 hints.ai_flags = 0;
                 //retry getaddrinfo
                 //retry getaddrinfo