My previous change to getgroups() broke the getgroups(0) special case,

which e.g. "awk" didn't like.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24691 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-03-30 20:02:38 +00:00
parent 71136ca48a
commit 9fe0705bee
1 changed files with 4 additions and 0 deletions

View File

@ -156,6 +156,10 @@ common_getgroups(int groupCount, gid_t* groupList, bool kernel)
actualCount = 1; actualCount = 1;
} }
// if groupCount 0 is supplied, we only return the number of groups
if (groupCount == 0)
return actualCount;
// check for sufficient space // check for sufficient space
if (groupCount < actualCount) if (groupCount < actualCount)
return B_BAD_VALUE; return B_BAD_VALUE;