* libmisc/getlong.c: Reset errno before calling strtol().

Otherwise, errno could be already set to ERANGE.
This commit is contained in:
nekral-guest 2008-06-14 21:02:52 +00:00
parent b8c5483b85
commit eed5fc7179
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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;