2009-03-09 01:56:56 +05:30
|
|
|
/*
|
2021-12-05 21:05:27 +05:30
|
|
|
* SPDX-FileCopyrightText: 2009 , Nicolas François
|
2009-03-09 01:56:56 +05:30
|
|
|
*
|
2021-12-05 21:05:27 +05:30
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2009-03-09 01:56:56 +05:30
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ident "$Id$"
|
|
|
|
|
|
|
|
#include "prototypes.h"
|
|
|
|
#include "defines.h"
|
|
|
|
|
|
|
|
int get_gid (const char *gidstr, gid_t *gid)
|
|
|
|
{
|
|
|
|
long long int val;
|
|
|
|
char *endptr;
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
val = strtoll (gidstr, &endptr, 10);
|
2009-04-23 17:16:06 +05:30
|
|
|
if ( ('\0' == *gidstr)
|
2009-03-09 01:56:56 +05:30
|
|
|
|| ('\0' != *endptr)
|
|
|
|
|| (ERANGE == errno)
|
2009-05-01 02:42:33 +05:30
|
|
|
|| (/*@+longintegral@*/val != (gid_t)val)/*@=longintegral@*/) {
|
2009-03-09 01:56:56 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-02-01 18:20:48 +05:30
|
|
|
*gid = val;
|
2009-03-09 01:56:56 +05:30
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|