[PATCH] lscpu: don't assume filesystem supports d_type when searching for NUMA nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Not all file systems support the d_type field and simply checking for
d_type == DT_DIR in is_node_dirent would cause the test suite to fail
if run on (for example) XFS.

The simple fix is to check for DT_DIR or DT_UNKNOWN in is_node_dirent.

Signed-off-by: Stewart Smith <stewart@xxxxxxxxxxxxxxxxxx>
---
 sys-utils/lscpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index b8840ef..4760d4e 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -919,7 +919,7 @@ static inline int is_node_dirent(struct dirent *d)
 	return
 		d &&
 #ifdef _DIRENT_HAVE_D_TYPE
-		d->d_type == DT_DIR &&
+		(d->d_type == DT_DIR || d->d_type == DT_UNKNOWN) &&
 #endif
 		strncmp(d->d_name, "node", 4) == 0 &&
 		isdigit_string(d->d_name + 4);
-- 
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux