From 07d993cbc1bd3b3ef474536fe4e61918519dc2c3 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 10 Oct 2009 00:34:32 +0200 Subject: 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 --- src/acl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/acl.c b/src/acl.c index 9ab643e..6f0418e 100644 --- a/src/acl.c +++ b/src/acl.c @@ -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 */ -- cgit v1.2.3