openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/shadow/4.6-r0/shadow-4.6/libmisc/find_new_gid.c
static int check_gid(const gid_t gid, const gid_t gid_min, const gid_t gid_max,
                     bool* used_gids)
{
    /* First test that the preferred ID is in the range */
    if (gid < gid_min || gid > gid_max)
    {
        return ERANGE;
    }

    /*
     * Check whether we already detected this GID
     * using the gr_next() loop
     */
    if (used_gids != NULL && used_gids[gid])
    {
        return EEXIST;
    }
    /* Check if the GID exists according to NSS */
    errno = 0;
    if (prefix_getgrgid(gid) != NULL)
    {
        return EEXIST;
    }
    else
    {
        /* getgrgid() was NULL
         * we have to ignore errors as temporary
         * failures of remote user identity services
         * would completely block user/group creation
         */
    }

    /* If we've made it here, the GID must be available */
    return 0;
}
/*
 * check_gid - See if the requested GID is available
 *
 * On success, return 0
 * If the ID is in use, return EEXIST
 * If the ID is outside the range, return ERANGE
 * In other cases, return errno from getgrgid()
 */
See if the requested GID is available
On success, return 0
If the ID is in use, return EEXIST
If the ID is outside the range, return ERANGE
In other cases, return errno from getgrgid()
See if the requested GID is available On success return 0 If the ID is in use return EEXIST If the ID is outside the range return ERANGE In other cases return errno from getgrgid ()
static int check_gid(const gid_t gid, const gid_t gid_min, const gid_t gid_max,
                     bool* used_gids)
{
    if (gid < gid_min || gid > gid_max)
    {
        return ERANGE;
    }
    if (used_gids != NULL && used_gids[gid])
    {
        return EEXIST;
    }
    errno = 0;
    if (prefix_getgrgid(gid) != NULL)
    {
        return EEXIST;
    }
    else
    {
    }
    return 0;
}
static int check_gid ( const gid_t gid , const gid_t gid_min , const gid_t gid_max , bool * used_gids ) { if ( gid < gid_min || gid > gid_max ) { return ERANGE ; } if ( used_gids != NULL && used_gids [ gid ] ) { return EEXIST ; } errno = 0 ; if ( prefix_getgrgid ( gid ) != NULL ) { return EEXIST ; } else { } return 0 ; }
check_gid - See if the requested GID is available
 On success, return 0
 If the ID is in use, return EEXIST
 If the ID is outside the range, return ERANGE
 In other cases, return errno from getgrgid()
check_gid - See if the requested GID is available On success return 0 If the ID is in use return EEXIST If the ID is outside the range return ERANGE In other cases return errno from getgrgid ()
/* First test that the preferred ID is in the range */ /*
     * Check whether we already detected this GID
     * using the gr_next() loop
     */ /* Check if the GID exists according to NSS */ /* getgrgid() was NULL
         * we have to ignore errors as temporary
         * failures of remote user identity services
         * would completely block user/group creation
         */ /* If we've made it here, the GID must be available */