Skip to content
Snippets Groups Projects
Commit fccdeb7e authored by Florian Schmaus's avatar Florian Schmaus
Browse files

[LinuxVersion] Do not log a warning if there are non-digits chars found

A Linux version including non-digits, like 5.15.23-gentoo-dist, is
very common and nothing we should warn about.
parent 08fb2c51
No related branches found
No related tags found
No related merge requests found
Pipeline #77671 passed
......@@ -8,7 +8,6 @@
#include <cstdlib>
#include "Common.hpp"
#include "Debug.hpp"
static auto checked_strtol(const std::string& s) -> long {
static const int DECIMAL = 10;
......@@ -25,9 +24,11 @@ static auto checked_strtol(const std::string& s) -> long {
DIE_MSG("strtol found no digits in " << s);
}
if (endptr != startptr + s.size()) {
LOGW("LinuxVersion compare ignored non digits in " << s)
}
// TODO: We could report remaining bytes of the string by returning
// std::string(endptr) together with 'res' (potentially using
// std::pair). Not sure if we even need to check if "endptr !=
// startptr + s.size()", or if we could always cosntruct
// std::string(endptr), potentially constructing the empty string.
return res;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment