diff options
Diffstat (limited to 'cpp/src/IceGrid/Activator.cpp')
-rw-r--r-- | cpp/src/IceGrid/Activator.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index 9c568f75ef5..a9a4508e910 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -656,6 +656,15 @@ Activator::activate(const string& name, getgrouplist(pw->pw_name, gid, &groups[0], &ngroups); #endif } + else + { + groups.resize(static_cast<size_t>(ngroups)); + } + + if(groups.size() > NGROUPS_MAX) + { + groups.resize(NGROUPS_MAX); + } int fds[2]; if(pipe(fds) != 0) @@ -719,9 +728,16 @@ Activator::activate(const string& name, if(getuid() == 0 && setgroups(static_cast<int>(groups.size()), &groups[0]) == -1) { ostringstream os; - os << pw->pw_name; - reportChildError(getSystemErrno(), errorFds[1], "cannot set process supplementary groups", os.str().c_str(), - _traceLevels); + for(vector<gid_t>::const_iterator p = groups.begin(); p != groups.end(); ++p) + { + os << *p; + if(p + 1 != groups.end()) + { + os << ", "; + } + } + reportChildError(getSystemErrno(), errorFds[1], "cannot set process supplementary groups", + os.str().c_str(), _traceLevels); } if(setuid(uid) == -1) |