diff src/lib/network.c @ 11086:260e190306b0 HEAD

Started using str_to_*() functions instead of libc's ones.
author Timo Sirainen <tss@iki.fi>
date Wed, 07 Apr 2010 01:49:00 +0300
parents a4666cc8cb7b
children 40964653930c
line wrap: on
line diff
--- a/src/lib/network.c	Wed Apr 07 01:48:03 2010 +0300
+++ b/src/lib/network.c	Wed Apr 07 01:49:00 2010 +0300
@@ -776,7 +776,7 @@
 		    unsigned int *bits_r)
 {
 	const char *p;
-	int bits, max_bits;
+	unsigned int bits, max_bits;
 
 	p = strchr(network, '/');
 	if (p != NULL)
@@ -791,8 +791,7 @@
 		bits = max_bits;
 	} else {
 		/* get the network mask */
-		bits = atoi(p);
-		if (bits < 0 || bits > max_bits)
+		if (str_to_uint(p, &bits) < 0 || bits > max_bits)
 			return -1;
 	}
 	*bits_r = bits;