提交 c3a7e0c5 编写于 作者: V Viktor Dukhovni

After saving errno clear it before calls to strtol et. al.

Reviewed-by: NRichard Levitte <levitte@openssl.org>
上级 bb3bdf05
...@@ -373,6 +373,7 @@ int opt_long(const char *value, long *result) ...@@ -373,6 +373,7 @@ int opt_long(const char *value, long *result)
long l; long l;
char *endp; char *endp;
errno = 0;
l = strtol(value, &endp, 0); l = strtol(value, &endp, 0);
if (*endp if (*endp
|| endp == value || endp == value
...@@ -398,6 +399,7 @@ int opt_imax(const char *value, intmax_t *result) ...@@ -398,6 +399,7 @@ int opt_imax(const char *value, intmax_t *result)
intmax_t m; intmax_t m;
char *endp; char *endp;
errno = 0;
m = strtoimax(value, &endp, 0); m = strtoimax(value, &endp, 0);
if (*endp if (*endp
|| endp == value || endp == value
...@@ -420,6 +422,7 @@ int opt_umax(const char *value, uintmax_t *result) ...@@ -420,6 +422,7 @@ int opt_umax(const char *value, uintmax_t *result)
uintmax_t m; uintmax_t m;
char *endp; char *endp;
errno = 0;
m = strtoumax(value, &endp, 0); m = strtoumax(value, &endp, 0);
if (*endp if (*endp
|| endp == value || endp == value
...@@ -445,6 +448,7 @@ int opt_ulong(const char *value, unsigned long *result) ...@@ -445,6 +448,7 @@ int opt_ulong(const char *value, unsigned long *result)
char *endptr; char *endptr;
unsigned long l; unsigned long l;
errno = 0;
l = strtoul(value, &endptr, 0); l = strtoul(value, &endptr, 0);
if (*endptr if (*endptr
|| endptr == value || endptr == value
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册