openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/libmount/src/optstr.c
int mnt_optstr_fix_gid(char** optstr, char* value, size_t valsz, char** next)
{
    char* end;

    if (!optstr || !*optstr || !value || !valsz)
        return -EINVAL;

    DBG(CXT, ul_debug("fixing gid"));

    end = value + valsz;

    if (valsz == 7 && !strncmp(value, "usergid", 7) &&
        (*(value + 7) == ',' || !*(value + 7)))
        return set_uint_value(optstr, getgid(), value, end, next);

    else if (!isdigit(*value))
    {
        int rc;
        gid_t id;
        char* p = strndup(value, valsz);
        if (!p)
            return -ENOMEM;
        rc = mnt_get_gid(p, &id);
        free(p);

        if (!rc)
            return set_uint_value(optstr, id, value, end, next);
    }

    if (next)
    {
        /* nothing */
        *next = value + valsz;
        if (**next == ',')
            (*next)++;
    }
    return 0;
}
/*
 * @optstr: string with a comma separated list of options
 * @value: pointer to the beginning of the uid value
 * @valsz: size of the value
 * @next: returns pointer to the next option (optional argument)

 * Translates "groupname" or "usergid" to the real GID.
 *
 * Returns: 0 on success, a negative number in case of error.
 */
@optstr: string with a comma separated list of options
@value: pointer to the beginning of the uid value
@valsz: size of the value
@next: returns pointer to the next option (optional argument)

Translates "groupname" or "usergid" to the real GID.

0 on success, a negative number in case of error.
@optstr : string with a comma separated list of options @value : pointer to the beginning of the uid value @valsz : size of the value @next : returns pointer to the next option ( optional argument ) Translates " groupname " or " usergid " to the real GID . 0 on success a negative number in case of error .
int mnt_optstr_fix_gid(char** optstr, char* value, size_t valsz, char** next)
{
    char* end;
    if (!optstr || !*optstr || !value || !valsz)
        return -EINVAL;
    DBG(CXT, ul_debug("fixing gid"));
    end = value + valsz;
    if (valsz == 7 && !strncmp(value, "usergid", 7) &&
        (*(value + 7) == ',' || !*(value + 7)))
        return set_uint_value(optstr, getgid(), value, end, next);
    else if (!isdigit(*value))
    {
        int rc;
        gid_t id;
        char* p = strndup(value, valsz);
        if (!p)
            return -ENOMEM;
        rc = mnt_get_gid(p, &id);
        free(p);
        if (!rc)
            return set_uint_value(optstr, id, value, end, next);
    }
    if (next)
    {
        *next = value + valsz;
        if (**next == ',')
            (*next)++;
    }
    return 0;
}
int mnt_optstr_fix_gid ( char * * optstr , char * value , size_t valsz , char * * next ) { char * end ; if ( ! optstr || ! * optstr || ! value || ! valsz ) return - EINVAL ; DBG ( CXT , ul_debug ( " " ) ) ; end = value + valsz ; if ( valsz == 7 && ! strncmp ( value , " " , 7 ) && ( * ( value + 7 ) == ' ' || ! * ( value + 7 ) ) ) return set_uint_value ( optstr , getgid ( ) , value , end , next ) ; else if ( ! isdigit ( * value ) ) { int rc ; gid_t id ; char * p = strndup ( value , valsz ) ; if ( ! p ) return - ENOMEM ; rc = mnt_get_gid ( p , & id ) ; free ( p ) ; if ( ! rc ) return set_uint_value ( optstr , id , value , end , next ) ; } if ( next ) { * next = value + valsz ; if ( * * next == ' ' ) ( * next ) ++ ; } return 0 ; }
@optstr: string with a comma separated list of options
 @value: pointer to the beginning of the uid value
 @valsz: size of the value
 @next: returns pointer to the next option (optional argument)
@optstr : string with a comma separated list of options @value : pointer to the beginning of the uid value @valsz : size of the value @next : returns pointer to the next option ( optional argument )
/* nothing */