Re: Like Topsy, UNIX growed uids and gids, as is the Chibi Scheme SRFI-170 implementation Lassi Kortela 29 Jul 2019 06:24 UTC
> | * Call count = getgroups(0, NULL) to get the actual count. > | * Then call getgroups(count, gid_array); > | > | I prefer this strategy. > > It looks like one still has to account for a race > condition with this approach. ...and the prize goes to Arthur :) The version where the group list doubles in size every call is safer. The Unix process would have to keep doubling the number of groups it's in faster than the Scheme code makes new getgroups() calls, which for all practical purposes is impossible. And with a reasonable initial group list size, this version will have to make only one getgroups() call, whereas the "count = getgroups(0, NULL)" version will have to make two calls every time.