diff options
author | Bernard Normier <bernard@zeroc.com> | 2019-07-15 05:14:32 -0400 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2019-07-15 11:14:32 +0200 |
commit | 2e60ce8af12b12a8c1aed18c7bea2413016d4004 (patch) | |
tree | 4f5f578bb99ea4713cbc1d0e57346b6036c70f10 /cpp/src/IceGrid/Activator.cpp | |
parent | Test script minor warning fixes (diff) | |
download | ice-2e60ce8af12b12a8c1aed18c7bea2413016d4004.tar.bz2 ice-2e60ce8af12b12a8c1aed18c7bea2413016d4004.tar.xz ice-2e60ce8af12b12a8c1aed18c7bea2413016d4004.zip |
Port to AIX with g++, xlC_r and xlclang++ (#434)
Diffstat (limited to 'cpp/src/IceGrid/Activator.cpp')
-rw-r--r-- | cpp/src/IceGrid/Activator.cpp | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index a9a4508e910..9a9fb38af2b 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -641,25 +641,47 @@ Activator::activate(const string& name, } vector<gid_t> groups; +#ifdef _AIX + char* grouplist = getgrset(pw->pw_name); + if(grouplist == 0) + { + throw SyscallException(__FILE__, __LINE__, getSystemErrno()); + } + vector<string> grps; + if(IceUtilInternal::splitString(grouplist, ",", grps)) + { + for(vector<string>::const_iterator p = grps.begin(); p != grps.end(); ++p) + { + gid_t group; + istringstream is(*p); + if(is >> group) + { + groups.push_back(group); + } + } + } + free(grouplist); +#else groups.resize(20); int ngroups = static_cast<int>(groups.size()); -#if defined(__APPLE__) +# if defined(__APPLE__) if(getgrouplist(pw->pw_name, static_cast<int>(gid), reinterpret_cast<int*>(&groups[0]), &ngroups) < 0) -#else +# else if(getgrouplist(pw->pw_name, gid, &groups[0], &ngroups) < 0) -#endif +# endif { groups.resize(static_cast<size_t>(ngroups)); -#if defined(__APPLE__) +# if defined(__APPLE__) getgrouplist(pw->pw_name, static_cast<int>(gid), reinterpret_cast<int*>(&groups[0]), &ngroups); -#else +# else getgrouplist(pw->pw_name, gid, &groups[0], &ngroups); -#endif +# endif } else { groups.resize(static_cast<size_t>(ngroups)); } +#endif if(groups.size() > NGROUPS_MAX) { |