aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/grp.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-02-04 17:53:08 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-02-04 17:53:08 +0000
commit0daf256192b56839708082f0788c5c477d1ef9d6 (patch)
treec7cbb2969a5dd1356d0367b57c64e1c7625d3dd1 /winsup/cygwin/grp.cc
parent4a21c2d5c8c87d5df8151300085fcc333a5ffefe (diff)
downloadnewlib-0daf256192b56839708082f0788c5c477d1ef9d6.zip
newlib-0daf256192b56839708082f0788c5c477d1ef9d6.tar.gz
newlib-0daf256192b56839708082f0788c5c477d1ef9d6.tar.bz2
* grp.cc (internal_getgroups): Do not return without closing
the process handle.
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r--winsup/cygwin/grp.cc41
1 files changed, 21 insertions, 20 deletions
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 41f2484..cee32a2 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -263,27 +263,28 @@ internal_getgroups (int gidsetsize, __gid32_t *grouplist, cygpsid * srchsid)
if (srchsid)
{
for (DWORD pg = 0; pg < groups->GroupCount; ++pg)
- if (*srchsid == groups->Groups[pg].Sid)
- return 1;
- return 0;
+ if ((cnt = (*srchsid == groups->Groups[pg].Sid)))
+ break;
+ cnt = -1;
}
- for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx)
- if (sid.getfromgr (gr))
- for (DWORD pg = 0; pg < groups->GroupCount; ++pg)
- if (sid == groups->Groups[pg].Sid &&
- sid != well_known_world_sid)
- {
- if (cnt < gidsetsize)
- grouplist[cnt] = gr->gr_gid;
- ++cnt;
- if (gidsetsize && cnt > gidsetsize)
- {
- if (hToken != cygheap->user.token)
- CloseHandle (hToken);
- goto error;
- }
- break;
- }
+ else
+ for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx)
+ if (sid.getfromgr (gr))
+ for (DWORD pg = 0; pg < groups->GroupCount; ++pg)
+ if (sid == groups->Groups[pg].Sid &&
+ sid != well_known_world_sid)
+ {
+ if (cnt < gidsetsize)
+ grouplist[cnt] = gr->gr_gid;
+ ++cnt;
+ if (gidsetsize && cnt > gidsetsize)
+ {
+ if (hToken != cygheap->user.token)
+ CloseHandle (hToken);
+ goto error;
+ }
+ break;
+ }
}
}
else