public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Stewart Smith <stewart@linux.vnet.ibm.com>
To: util-linux@vger.kernel.org
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>
Subject: [PATCH] lscpu: don't assume filesystem supports d_type when searching for NUMA nodes
Date: Tue,  4 Mar 2014 15:27:27 +1100	[thread overview]
Message-ID: <1393907247-23750-1-git-send-email-stewart@linux.vnet.ibm.com> (raw)

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 | 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


             reply	other threads:[~2014-03-04  4:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04  4:27 Stewart Smith [this message]
2014-03-04 10:48 ` [PATCH] lscpu: don't assume filesystem supports d_type when searching for NUMA nodes Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393907247-23750-1-git-send-email-stewart@linux.vnet.ibm.com \
    --to=stewart@linux.vnet.ibm.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox