This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] malloc: make numa_node_count more robust


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]