From 830526a51292e6241f7b6415e070f3780fe18e1e Mon Sep 17 00:00:00 2001 From: Ulrich Weber Date: Wed, 21 Dec 2011 02:24:11 +0400 Subject: lib: fix some strtoul() use cases ...otherwise 4294967295 is not a valid value on 32bit systems --- lib/vty.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/vty.h b/lib/vty.h index 7df04b5f..639d7417 100644 --- a/lib/vty.h +++ b/lib/vty.h @@ -152,8 +152,9 @@ struct vty #define VTY_GET_LONG(NAME,V,STR) \ do { \ char *endptr = NULL; \ + errno = 0; \ (V) = strtoul ((STR), &endptr, 10); \ - if (*endptr != '\0' || (V) == ULONG_MAX) \ + if (*(STR) == '-' || *endptr != '\0' || errno) \ { \ vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \ return CMD_WARNING; \ -- cgit v1.2.1