* libmisc/getlong.c: Reset errno before calling strtol().
Otherwise, errno could be already set to ERANGE.
This commit is contained in:
parent
b8c5483b85
commit
eed5fc7179
@ -1,3 +1,8 @@
|
||||
2008-06-14 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/getlong.c: Reset errno before calling strtol().
|
||||
Otherwise, errno could be already set to ERANGE.
|
||||
|
||||
2008-06-14 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/Makefile.am, libmisc/getrange.c: Added function to parse
|
||||
|
@ -39,6 +39,7 @@ int getlong(const char *numstr, long int *result)
|
||||
long val;
|
||||
char *endptr;
|
||||
|
||||
errno = 0;
|
||||
val = strtol (numstr, &endptr, 10);
|
||||
if (('\0' != *endptr) || (ERANGE == errno)) {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user