From 4cebad3859f8cc4fe526a89ef2277d1db9ee9b7c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 6 Jul 2021 16:06:23 +0200 Subject: Clear errno before calling strto*() functions --- libbutl/builtin.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'libbutl/builtin.cxx') diff --git a/libbutl/builtin.cxx b/libbutl/builtin.cxx index a6bb94b..61df568 100644 --- a/libbutl/builtin.cxx +++ b/libbutl/builtin.cxx @@ -1929,6 +1929,7 @@ namespace butl if (!a.empty () && a[0] != '-' && a[0] != '+') { char* e (nullptr); + errno = 0; // We must clear it according to POSIX. n = strtoull (a.c_str (), &e, 10); // Can't throw. if (errno != ERANGE && e == a.c_str () + a.size ()) -- cgit v1.1