lkml.org 
[lkml]   [2018]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] perf vendor events: fix processing for xfs
Date
In the recently introduced support for vendor subdirectory,
the checking for directory entries under xfs (or any other fs
which does not support dirent.d_type) is missing the check
for links for current and parent directory. This can result
in a broken pmu_events.c being generated.

Fix this by adding the appropriate check in is_leaf_dir().

Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: John Garry <john.garry@huawei.com>

diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 1c01844..db3a594 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -873,7 +873,10 @@ static int is_leaf_dir(const char *fpath)
return 0;

while ((dir = readdir(d)) != NULL) {
- if (dir->d_type == DT_DIR && dir->d_name[0] != '.') {
+ if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
+ continue;
+
+ if (dir->d_type == DT_DIR) {
res = 0;
break;
} else if (dir->d_type == DT_UNKNOWN) {
--
1.9.1
\
 
 \ /
  Last update: 2018-03-14 18:12    [W:1.182 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site