Blob Blame History Raw
diff -up numactl-2.0.6/libnuma.c.orig numactl-2.0.6/libnuma.c
--- numactl-2.0.6/libnuma.c.orig	2010-12-29 08:23:11.000000000 -0500
+++ numactl-2.0.6/libnuma.c	2011-01-04 16:10:58.514024338 -0500
@@ -1263,9 +1263,10 @@ numa_node_to_cpus_v1(int node, unsigned 
 	sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node);
 	f = fopen(fn, "r");
 	if (!f || getdelim(&line, &len, '\n', f) < 1) {
-		numa_warn(W_nosysfs2,
-		   "/sys not mounted or invalid. Assuming one node: %s",
-			  strerror(errno));
+		if (f)
+			numa_warn(W_nosysfs2,
+			   "/sys not mounted or invalid. Assuming one node: %s",
+				  strerror(errno));
 		bitmask.maskp = (unsigned long *)mask;
 		bitmask.size  = buflen_needed * 8;
 		numa_bitmask_setall(&bitmask);
@@ -1341,13 +1342,15 @@ numa_node_to_cpus_v2(int node, struct bi
 	sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node); 
 	f = fopen(fn, "r"); 
 	if (!f || getdelim(&line, &len, '\n', f) < 1) { 
-		numa_warn(W_nosysfs2,
-		   "/sys not mounted or invalid. Assuming one node: %s",
-			  strerror(errno)); 
-		numa_warn(W_nosysfs2,
-		   "(cannot open or correctly parse %s)", fn);
-		numa_bitmask_setall(mask);
-		err = -1;
+		if (f) {
+			numa_warn(W_nosysfs2,
+			   "/sys not mounted or invalid. Assuming one node: %s",
+				  strerror(errno)); 
+			numa_warn(W_nosysfs2,
+			   "(cannot open or correctly parse %s)", fn);
+			numa_bitmask_setall(mask);
+			err = -1;
+		}
 	} 
 	if (f)
 		fclose(f);