Commit 01c150d5 authored by Yablonskyy@axilera.com's avatar Yablonskyy@axilera.com Committed by Sara Golemon

Add EOS checking to 'parseLeadingNumber' function.

Summary: parseLeadingNumber does not contain EOS validation and raise an exception when '/sys/devices/system/cpu/cpu0/index0/shared_cpu_list' contains only one number like '0'.
Closes #207

Reviewed By: @yfeldblum

Differential Revision: D2148015

Pulled By: @sgolemon
parent 2bf6f465
...@@ -84,7 +84,7 @@ static size_t parseLeadingNumber(const std::string& line) { ...@@ -84,7 +84,7 @@ static size_t parseLeadingNumber(const std::string& line) {
auto raw = line.c_str(); auto raw = line.c_str();
char *end; char *end;
unsigned long val = strtoul(raw, &end, 10); unsigned long val = strtoul(raw, &end, 10);
if (end == raw || (*end != ',' && *end != '-' && *end != '\n')) { if (end == raw || (*end != ',' && *end != '-' && *end != '\n' && *end != 0)) {
throw std::runtime_error(to<std::string>( throw std::runtime_error(to<std::string>(
"error parsing list '", line, "'").c_str()); "error parsing list '", line, "'").c_str());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment