]> granicus.if.org Git - shadow/commitdiff
* libmisc/getlong.c: Reset errno before calling strtol().
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 14 Jun 2008 21:02:52 +0000 (21:02 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 14 Jun 2008 21:02:52 +0000 (21:02 +0000)
Otherwise, errno could be already set to ERANGE.

ChangeLog
libmisc/getlong.c

index 1f12e660771c6900e23aac4da9ba89e1dd54b1a2..fcde3dfbfc8f15d1250f529b664fc1cc39b919b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 7ea3a80db891cc6792ad00fa3addc3d6a0d5bd73..7c3d2ce0634f303e7d1d602ef78cd015416ea088 100644 (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;