From: Yan, Zheng Date: Fri, 14 Aug 2015 14:52:09 +0000 (+0800) Subject: client: fix compile error on OSX X-Git-Tag: v9.1.0~259^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=68db9f6fdaefe07314743c0caafc9935d38cc640;p=ceph.git client: fix compile error on OSX On OSX, type of the 3rd parameters of getgrouplist is 'int *' Signed-off-by: Yan, Zheng --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 9fbf72ddc5e..defcf99790f 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -95,6 +95,7 @@ using namespace std; #if HAVE_GETGROUPLIST #include #include +#include #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) {