summaryrefslogtreecommitdiff
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2023-01-23 09:56:00 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-01-23 09:56:00 -0300
commit91f67b9a6472a243e2c0630f637ddff0af08038e (patch)
tree2ba948b5b9a9c13b3494efb3a4006c15db1cbb37 /tools/perf/util
parent5670ebf54bd26482f57a094c53bdc562c106e0a9 (diff)
parent2475bf0250dee99b477e0c56d7dc9d7ac3f04117 (diff)
Merge remote-tracking branch 'torvalds/master' into perf/core
To pick fixes that went via perf/urgent. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/build-id.c10
-rw-r--r--tools/perf/util/expr.l5
2 files changed, 11 insertions, 4 deletions
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index a839b30c981b7..ea9c083ab1e3f 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -715,9 +715,13 @@ build_id_cache__add(const char *sbuild_id, const char *name, const char *realnam
} else if (nsi && nsinfo__need_setns(nsi)) {
if (copyfile_ns(name, filename, nsi))
goto out_free;
- } else if (link(realname, filename) && errno != EEXIST &&
- copyfile(name, filename))
- goto out_free;
+ } else if (link(realname, filename) && errno != EEXIST) {
+ struct stat f_stat;
+
+ if (!(stat(name, &f_stat) < 0) &&
+ copyfile_mode(name, filename, f_stat.st_mode))
+ goto out_free;
+ }
}
/* Some binaries are stripped, but have .debug files with their symbol
diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l
index 0168a96373309..d47de5f270a8e 100644
--- a/tools/perf/util/expr.l
+++ b/tools/perf/util/expr.l
@@ -42,8 +42,11 @@ static char *normalize(char *str, int runtime)
char *dst = str;
while (*str) {
- if (*str == '\\')
+ if (*str == '\\') {
*dst++ = *++str;
+ if (!*str)
+ break;
+ }
else if (*str == '?') {
char *paramval;
int i = 0;