summaryrefslogtreecommitdiffstats
path: root/sys-utils/lscpu.c
diff options
context:
space:
mode:
authorStewart Smith2014-03-04 05:27:27 +0100
committerKarel Zak2014-03-04 11:47:23 +0100
commitc0cf4ae9b05a88dfbace18dd05d23fb0b2d19dab (patch)
treec42e7c26600d067e5bca58914f67c3f9e1861b4b /sys-utils/lscpu.c
parentswitch_root: make dirent d_type usage more robust (diff)
downloadkernel-qcow2-util-linux-c0cf4ae9b05a88dfbace18dd05d23fb0b2d19dab.tar.gz
kernel-qcow2-util-linux-c0cf4ae9b05a88dfbace18dd05d23fb0b2d19dab.tar.xz
kernel-qcow2-util-linux-c0cf4ae9b05a88dfbace18dd05d23fb0b2d19dab.zip
lscpu: don't assume filesystem supports d_type when searching for NUMA nodes
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@linux.vnet.ibm.com>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r--sys-utils/lscpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index b8840ef90..4760d4e39 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);