summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorUlrich Weber <ulrich.weber@sophos.com>2011-12-21 02:24:11 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2012-01-02 19:13:28 +0400
commit664711c1f4cc218073783ff6ce362093debd7b53 (patch)
tree5566b0c8b9d22de55772717ad6c701ea85b6241e /lib
parent6fd16207fee6d4d09f29ed7ecf26303a7220e473 (diff)
lib: fix some strtoul() use cases
...otherwise 4294967295 is not a valid value on 32bit systems
Diffstat (limited to 'lib')
-rw-r--r--lib/vty.h3
1 files changed, 2 insertions, 1 deletions
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; \