summaryrefslogtreecommitdiff
path: root/tools/perf/util/build-id.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-22 08:37:23 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-22 08:37:23 +0100
commit99ba2ad1db623df79456b8556b3f4900f394c8c2 (patch)
tree2bf6a20de87f0a5b944fd69d53723fc4710d7b7e /tools/perf/util/build-id.c
parent18e126e97c961f7a93823795c879d7c085fe5098 (diff)
parent2241ab53cbb5cdb08a6b2d4688feb13971058f65 (diff)
downloadlinux-99ba2ad1db623df79456b8556b3f4900f394c8c2.tar.gz
Merge 6.2-rc5 into char-misc-next
We need the char/misc driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/perf/util/build-id.c')
-rw-r--r--tools/perf/util/build-id.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index a839b30c981b..ea9c083ab1e3 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