]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix compile error on OSX
authorYan, Zheng <zyan@redhat.com>
Fri, 14 Aug 2015 14:52:09 +0000 (22:52 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 31 Aug 2015 08:00:28 +0000 (16:00 +0800)
On OSX, type of the 3rd parameters of getgrouplist is 'int *'

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/client/Client.cc

index 9fbf72ddc5e4490e4e769e3994def5f0c0a9f94c..defcf99790f6f8500e069df56d87628f34faa885 100644 (file)
@@ -95,6 +95,7 @@ using namespace std;
 #if HAVE_GETGROUPLIST
 #include <grp.h>
 #include <pwd.h>
+#include <unistd.h>
 #endif
 
 #undef dout_prefix
@@ -4582,7 +4583,11 @@ int Client::check_permissions(Inode *in, int flags, int uid, int gid)
       return -EACCES;
     }
     while (1) {
+#if defined(__APPLE__)
+      if (getgrouplist(pw->pw_name, gid, (int *)sgids, &sgid_count) == -1) {
+#else
       if (getgrouplist(pw->pw_name, gid, sgids, &sgid_count) == -1) {
+#endif
         // we need to resize the group list and try again
         sgids = (gid_t*)realloc(sgids, sgid_count * sizeof(gid_t));
         if (sgids == NULL) {