From 68db9f6fdaefe07314743c0caafc9935d38cc640 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Fri, 14 Aug 2015 22:52:09 +0800 Subject: [PATCH] client: fix compile error on OSX On OSX, type of the 3rd parameters of getgrouplist is 'int *' Signed-off-by: Yan, Zheng --- src/client/Client.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client/Client.cc b/src/client/Client.cc index 9fbf72ddc5e4..defcf99790f6 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) { -- 2.47.3