[v0.98][Refactoring] Use printWarn + strerror(errno) instead of perror. Use fallback in ppc in case total_cores cannot be retrieved

This commit is contained in:
Dr-Noob
2021-08-07 08:43:46 +02:00
parent c24dd7cbb6
commit 2b21326167
5 changed files with 19 additions and 21 deletions

View File

@@ -44,8 +44,7 @@ long get_freq_from_file(char* path, bool hv_present) {
errno = 0;
long ret = strtol(buf, &end, 10);
if(errno != 0) {
perror("strtol");
printBug("Failed parsing '%s' file. Read data was: '%s'", path, buf);
printBug("strtol: %s", strerror(errno));
free(buf);
return UNKNOWN_FREQ;
}
@@ -77,8 +76,7 @@ long get_cache_size_from_file(char* path) {
errno = 0;
long ret = strtol(buf, &end, 10);
if(errno != 0) {
perror("strtol");
printBug("Failed parsing '%s' file. Read data was: '%s'", path, buf);
printBug("strtol: %s", strerror(errno));
free(buf);
return -1;
}
@@ -146,8 +144,7 @@ int get_num_caches_from_files(char** paths, int num_paths) {
errno = 0;
long ret = strtol(buf, &end, 16);
if(errno != 0) {
perror("strtol");
printBug("Failed parsing '%s' file. Read data was: '%s'", paths[i], buf);
printBug("strtol: %s", strerror(errno));
free(buf);
return -1;
}