Back to index

glibc  2.9
Defines | Functions
group_member.c File Reference
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>

Go to the source code of this file.

Defines

#define NGROUPS_MAX   16 /* First guess. */

Functions

int __group_member (gid_t gid)

Define Documentation

#define NGROUPS_MAX   16 /* First guess. */

Definition at line 26 of file group_member.c.


Function Documentation

Definition at line 30 of file group_member.c.

{
  int n, size;
  gid_t *groups;

  size = NGROUPS_MAX;
  do
    {
      groups = __alloca (size * sizeof *groups);
      n = __getgroups (size, groups);
      size *= 2;
    } while (n == size / 2);

  while (n >= 0)
    if (groups[n--] == gid)
      return 1;

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: