On Feb 13 11:11, Shaddy Baddah wrote: > On 12/02/2010 11:49 AM, Corinna Vinschen wrote: > >Alternatively: > > > > getgroups(); > > for all gids > > gr = getgrgid(); > > if (!strcasecmp (gr->gr_passwd, "S-1-32-544")) > > return is_admin; > > return non_admin; > > Doh! Why didn't I think of that. That would of course be easier. Does > the underlying implementation of getgrgid() scan through > /etc/group. If not, then this would also have been quicker.
/etc/group is scanned only once. After that, any read is done in memory (unless the file itself is updated). Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat