summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c4413ca)
raw | patch | inline | side by side (parent: c4413ca)
author | Kim Jones <kim-marie.jones@intel.com> | |
Wed, 17 Aug 2016 09:08:27 +0000 (10:08 +0100) | ||
committer | Kim Jones <kim-marie.jones@intel.com> | |
Wed, 17 Aug 2016 12:30:57 +0000 (13:30 +0100) |
Change-Id: Ib361b648407c7052218c1f6b9b624cb7aa799634
Signed-off-by: Kim Jones <kim-marie.jones@intel.com>
Signed-off-by: Kim Jones <kim-marie.jones@intel.com>
src/hugepages.c | patch | blob | history |
diff --git a/src/hugepages.c b/src/hugepages.c
index 120dd798c0d507db3534a510b104f4850b93e7d9..ac9441d092ecc9227e977f9971a3c0d323c614c3 100644 (file)
--- a/src/hugepages.c
+++ b/src/hugepages.c
while ((result = readdir(dir)) != NULL) {
if (strncmp(result->d_name, hugepages_dir, sizeof(hugepages_dir)-1)) {
/* not node dir */
+ errno = 0;
continue;
}
e_info.d_name = result->d_name;
e_info.node = node;
walk_directory(path2, read_hugepage_entry, &e_info, 0);
+ errno = 0;
}
- closedir(dir);
+ /* Check if NULL return from readdir() was an error */
+ if (errno != 0) {
+ ERROR("%s: readdir failed", g_plugin_name);
+ closedir(dir);
+ return -1;
+ }
+ closedir(dir);
return 0;
}
while ((result = readdir(dir)) != NULL) {
if (strncmp(result->d_name, node_string, sizeof(node_string)-1)) {
/* not node dir */
+ errno = 0;
continue;
}
ssnprintf(path, (size_t) lim, sys_node_hugepages, result->d_name);
read_syshugepages(path, result->d_name);
+ errno = 0;
}
- closedir(dir);
+ /* Check if NULL return from readdir() was an error */
+ if (errno != 0) {
+ ERROR("%s: readdir failed", g_plugin_name);
+ closedir(dir);
+ return -1;
+ }
+ closedir(dir);
return 0;
}