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

Neil Horman 8629a1
diff -up numactl-2.0.3-rc3/libnuma.c.orig numactl-2.0.3-rc3/libnuma.c
Neil Horman 8629a1
--- numactl-2.0.3-rc3/libnuma.c.orig	2009-06-17 13:13:28.000000000 -0400
Neil Horman 8629a1
+++ numactl-2.0.3-rc3/libnuma.c	2009-06-17 13:14:10.000000000 -0400
Neil Horman 8629a1
@@ -1209,9 +1209,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);
Neil Horman 8629a1
@@ -1287,9 +1288,10 @@ 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)); 
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
 		numa_bitmask_setall(mask);
Neil Horman 8629a1
 		err = -1;
Neil Horman 8629a1
 	}