aboutsummaryrefslogtreecommitdiff
path: root/libbutl/standard-version.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-07-06 16:06:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-07-06 16:06:23 +0200
commit4cebad3859f8cc4fe526a89ef2277d1db9ee9b7c (patch)
tree980ef15cfa6d2742f28afcbeaaf528d9f3637353 /libbutl/standard-version.cxx
parent739c96fc8e0dd5e9889149ece229c5300f3a58fb (diff)
Clear errno before calling strto*() functions
Diffstat (limited to 'libbutl/standard-version.cxx')
-rw-r--r--libbutl/standard-version.cxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/libbutl/standard-version.cxx b/libbutl/standard-version.cxx
index a9f5eb8..863cb29 100644
--- a/libbutl/standard-version.cxx
+++ b/libbutl/standard-version.cxx
@@ -60,6 +60,7 @@ namespace butl
const char* b (s.c_str () + p);
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 || b == e || v < min || v > max)