diff options
Diffstat (limited to 'wsutil/clopts_common.c')
-rw-r--r-- | wsutil/clopts_common.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/wsutil/clopts_common.c b/wsutil/clopts_common.c index 78763328d5..95d2850cba 100644 --- a/wsutil/clopts_common.c +++ b/wsutil/clopts_common.c @@ -33,11 +33,10 @@ int get_natural_int(const char *string, const char *name) { - const char *end; gint32 number; - if (!ws_strtoi32(string, &end, &number)) { - if (errno == EINVAL || *end != '\0') { + if (!ws_strtoi32(string, NULL, &number)) { + if (errno == EINVAL) { cmdarg_err("The specified %s \"%s\" isn't a decimal number", name, string); exit(1); } @@ -74,11 +73,10 @@ get_positive_int(const char *string, const char *name) guint32 get_guint32(const char *string, const char *name) { - const char *end; guint32 number; - if (!ws_strtou32(string, &end, &number)) { - if (errno == EINVAL || *end != '\0') { + if (!ws_strtou32(string, NULL, &number)) { + if (errno == EINVAL) { cmdarg_err("The specified %s \"%s\" isn't a decimal number", name, string); exit(1); } |