Fix atoint for out of range

This commit is contained in:
Roy Marples 2007-11-15 17:58:39 +00:00
parent 05bea32986
commit bbcd33d4f5

View File

@ -107,9 +107,10 @@ char *dhcpcd_skiproutes = NULL;
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)))
{