diff options
author | Michael Adam <obnox@samba.org> | 2009-10-10 00:34:32 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-10-10 01:11:53 +0200 |
commit | 07d993cbc1bd3b3ef474536fe4e61918519dc2c3 (patch) | |
tree | 1a5c08892e1bd38b4ded00d52154b049dfec50e6 | |
parent | a89d987e8a518f9166de9418a00f1ce27a9569ae (diff) |
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
-rw-r--r-- | src/acl.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 */ |