aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-07-06 16:07:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-07-06 16:07:15 +0200
commitac12de7e0343efdac0d0aa42e982b1b84dbd6124 (patch)
treef0467ae85b8fa4d2f9e24bdbfe58e6052768e761 /libbuild2
parentc770f928c88950d9044167e2e2897a9ab18547cf (diff)
Clear errno before calling strto*() functions
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/utility.cxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/libbuild2/utility.cxx b/libbuild2/utility.cxx
index 193610f..f7f3d41 100644
--- a/libbuild2/utility.cxx
+++ b/libbuild2/utility.cxx
@@ -603,6 +603,7 @@ namespace build2
{
const char* b (s.c_str ());
char* e (nullptr);
+ errno = 0; // We must clear it according to POSIX.
uint64_t v (strtoull (b, &e, 10)); // Can't throw.
if (errno != ERANGE && e == b + s.size () && v <= max_num)