[PATCH v10] posix: Deprecate group_member for Linux

Joe Simmons-Talbott josimmon@redhat.com
Wed Mar 27 18:45:31 GMT 2024


On Wed, Mar 27, 2024 at 12:24 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> On 3/27/24 06:00, Joe Simmons-Talbott wrote:
> > +      int gm = __group_member2 (stats.st_gid);
> > +      if (stats.st_gid == ((flag & AT_EACCESS)
> > +                         ? __getegid ()
> > +                         : __getgid ()) || (gm && gm != -1))
> > +        granted = (unsigned int) (stats.st_mode & (mode << 3)) >> 3;
> > +      else if (gm == -1)
> > +        return -1;
>
> This is not best, as it calls __group_member2 even when (stats.st_gid ==
> (flag & AT_EACCESS ? __getegid () : __getgid ())) and there is no need
> for the __group_member2 overhead in that case. The old code didn't have
> this problem.
>

Indeed.  I've posted a v11[1].

Thanks,
Joe

[1] https://sourceware.org/pipermail/libc-alpha/2024-March/155633.html

-- 
Joe Simmons-Talbott



More information about the Libc-alpha mailing list