This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] malloc: make numa_node_count more robust
- From: Joern Engel <joern at purestorage dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Cc: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>, Joern Engel <joern at purestorage dot com>
- Date: Mon, 25 Jan 2016 16:25:23 -0800
- Subject: [PATCH] malloc: make numa_node_count more robust
- Authentication-results: sourceware.org; auth=none
- References: <1453767942-19369-1-git-send-email-joern at purestorage dot com>
Gcc was warning that ret might be undefined. Given a Linux system, this
is pretty hard to imagine. But any fix that removes more code than it
adds is a good fix in my book.
JIRA: PURE-27597
---
tpc/malloc2.13/arena.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tpc/malloc2.13/arena.h b/tpc/malloc2.13/arena.h
index 20c3614e65bf..8890e83ad18f 100644
--- a/tpc/malloc2.13/arena.h
+++ b/tpc/malloc2.13/arena.h
@@ -310,12 +310,10 @@ static int numa_node_count(void)
{
DIR *d;
struct dirent *de;
- int ret;
+ int ret = 1;
d = opendir("/sys/devices/system/node");
- if (!d) {
- ret = 1;
- } else {
+ if (d) {
while ((de = readdir(d)) != NULL) {
int nd;
if (strncmp(de->d_name, "node", 4))
--
2.7.0.rc3