]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: don't assume filesystem supports d_type when searching for NUMA nodes
authorStewart Smith <stewart@linux.vnet.ibm.com>
Tue, 4 Mar 2014 04:27:27 +0000 (15:27 +1100)
committerKarel Zak <kzak@redhat.com>
Tue, 4 Mar 2014 10:47:23 +0000 (11:47 +0100)
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>
sys-utils/lscpu.c

index b8840ef90a99a876fb1580a58af8c5cdc056b21f..4760d4e3903daaaacd33e5ee3ed18d4f997efb06 100644 (file)
@@ -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);