Merge pull request #178 from hejingxian123/commit

Add return value check of opendir in do_one_cpu
This commit is contained in:
Neil Horman 2021-04-13 07:51:18 -04:00 committed by GitHub
commit 7ec539331d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -366,7 +366,7 @@ static void do_one_cpu(char *path)
struct topo_obj *node;
dir = opendir(path);
do {
while (dir) {
entry = readdir(dir);
if (!entry)
break;
@ -379,8 +379,9 @@ static void do_one_cpu(char *path)
break;
}
}
} while (entry);
closedir(dir);
}
if (dir)
closedir(dir);
/*
* In case of multiple NUMA nodes within a CPU package,