changeset 242:43bd36a18297 draft

Fix atoint for out of range
author Roy Marples <roy@marples.name>
date Thu, 15 Nov 2007 17:58:39 +0000
parents 5ab6cece6c6b
children 16b9a7acc7a2
files dhcpcd.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dhcpcd.c	Thu Nov 15 17:57:10 2007 +0000
+++ b/dhcpcd.c	Thu Nov 15 17:58:39 2007 +0000
@@ -107,9 +107,10 @@
 static int atoint (const char *s)
 {
 	char *t;
-	long n = strtol (s, &t, 0);
-	
+	long n;
+
 	errno = 0;
+	n = strtol (s, &t, 0);
 	if ((errno != 0 && n == 0) || s == t ||
 		(errno == ERANGE && (n == LONG_MAX || n == LONG_MIN)))
 	{