Selaa lähdekoodia

HADOOP-10699. Fix build native library on mac osx. Contributed by Binglin Chang

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1603042 13f79535-47bb-0310-9956-ffa450edef68
Jason Darrell Lowe 11 vuotta sitten
vanhempi
commit
c1eda00e84

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -562,6 +562,9 @@ Release 2.5.0 - UNRELEASED
     HADOOP-10702. KerberosAuthenticationHandler does not log the principal names
     correctly. (Benoy Antony via cnauroth)
 
+    HADOOP-10699. Fix build native library on mac osx (Binglin Chang via
+    jlowe)
+
   BREAKDOWN OF HADOOP-10514 SUBTASKS AND RELATED JIRAS
 
     HADOOP-10520. Extended attributes definition and FileSystem APIs for

+ 4 - 3
hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c

@@ -73,7 +73,10 @@ Java_org_apache_hadoop_security_JniBasedUnixGroupsNetgroupMapping_getUsersForNet
   // was successful or not (as long as it was called we need to call
   // endnetgrent)
   setnetgrentCalledFlag = 1;
-#ifndef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__MACH__)
+  setnetgrent(cgroup);
+  {
+#else
   if(setnetgrent(cgroup) == 1) {
 #endif
     current = NULL;
@@ -90,9 +93,7 @@ Java_org_apache_hadoop_security_JniBasedUnixGroupsNetgroupMapping_getUsersForNet
         userListSize++;
       }
     }
-#ifndef __FreeBSD__
   }
-#endif
 
   //--------------------------------------------------
   // build return data (java array)