mirror of
https://sourceware.org/git/glibc.git
synced 2025-12-24 17:51:17 +03:00
Correct checking loop in group_member.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* `group_member' -- test if process is in a given group.
|
||||
Copyright (C) 1995, 1997, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1997, 2002, 2010 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -39,10 +39,11 @@ __group_member (gid)
|
||||
groups = __alloca (size * sizeof *groups);
|
||||
n = __getgroups (size, groups);
|
||||
size *= 2;
|
||||
} while (n == size / 2);
|
||||
}
|
||||
while (n == size / 2);
|
||||
|
||||
while (n >= 0)
|
||||
if (groups[n--] == gid)
|
||||
while (n-- > 0)
|
||||
if (groups[n] == gid)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user