[v0.98][PPC] Check if udev functions failed

This commit is contained in:
Dr-Noob
2021-08-06 09:37:03 +02:00
parent 44d4b3b553
commit 7e1dde3c71
2 changed files with 13 additions and 4 deletions

View File

@@ -1,3 +1,6 @@
#include <errno.h>
#include "../common/global.h"
#include "udev.h"
#define _PATH_TOPO_CORE_ID "topology/core_id"
@@ -12,14 +15,14 @@ bool fill_array_from_sys(int *core_ids, int total_cores, char* SYS_PATH) {
for(int i=0; i < total_cores; i++) {
sprintf(path, "%s%s/cpu%d/%s", _PATH_SYS_SYSTEM, _PATH_SYS_CPU, i, SYS_PATH);
if((buf = read_file(path, &filelen)) == NULL) {
perror("open");
printWarn("fill_array_from_sys: %s: %s", path, strerror(errno));
return false;
}
errno = 0;
core_ids[i] = strtol(buf, &end, 10);
if(errno != 0) {
perror("strtol");
printWarn("fill_array_from_sys: %s:", strerror(errno));
return false;
}
free(buf);