public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lscpu: don't assume filesystem supports d_type when searching for NUMA nodes
@ 2014-03-04  4:27 Stewart Smith
  2014-03-04 10:48 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Stewart Smith @ 2014-03-04  4:27 UTC (permalink / raw)
  To: util-linux; +Cc: Stewart Smith

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lscpu: don't assume filesystem supports d_type when searching for NUMA nodes
  2014-03-04  4:27 [PATCH] lscpu: don't assume filesystem supports d_type when searching for NUMA nodes Stewart Smith
@ 2014-03-04 10:48 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-03-04 10:48 UTC (permalink / raw)
  To: Stewart Smith; +Cc: util-linux

On Tue, Mar 04, 2014 at 03:27:27PM +1100, Stewart Smith wrote:
>  sys-utils/lscpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

 Good catch! Applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-04 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-04  4:27 [PATCH] lscpu: don't assume filesystem supports d_type when searching for NUMA nodes Stewart Smith
2014-03-04 10:48 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox