Blame numactl-2.0.3-rc3-no-nodes-warning.patch

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