acl: Fix "comparison between signed and unsigned" warning on 32bit

This reads the mask bits as an unsigned int instead of as signend.
This is also what mask bits really are - there is no negative mask. :-)

Michael
This commit is contained in:
Michael Adam 2009-10-10 00:34:32 +02:00
parent a89d987e8a
commit 07d993cbc1

View File

@ -75,19 +75,19 @@ fill_netmask_array (char *bitmask_string, unsigned char array[],
size_t len)
{
unsigned int i;
long int mask;
unsigned long int mask;
char *endptr;
errno = 0; /* to distinguish success/failure after call */
mask = strtol (bitmask_string, &endptr, 10);
mask = strtoul (bitmask_string, &endptr, 10);
/* check for various conversion errors */
if ((errno == ERANGE && (mask == LONG_MIN || mask == LONG_MAX))
if ((errno == ERANGE && mask == ULONG_MAX)
|| (errno != 0 && mask == 0) || (endptr == bitmask_string))
return -1;
/* valid range for a bit mask */
if (mask < 0 || mask > (8 * len))
if (mask > (8 * len))
return -1;
/* we have a valid range to fill in the array */