diff options
author | Ingo Molnar <mingo@elte.hu> | 2011-01-04 08:08:51 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-01-04 08:08:54 +0100 |
commit | cc2221969906a166a638aecdbae84a3d0462719e (patch) | |
tree | 2483f726e226c309207e1d0250660eea6e1787b8 /tools/perf/util/header.c | |
parent | 56f4c400349157289b474a3fd49ee96acab0a4d7 (diff) | |
parent | 387c31c7e5c9805b0aef8833d1731a5fe7bdea14 (diff) |
Merge commit 'v2.6.37-rc8' into perf/core
Merge reason: pick up latest -rc.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r-- | tools/perf/util/header.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 16a16021eaa6..4b8c8397a947 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -270,15 +270,16 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, const char *name, bool is_kallsyms) { const size_t size = PATH_MAX; - char *filename = malloc(size), + char *realname = realpath(name, NULL), + *filename = malloc(size), *linkname = malloc(size), *targetname; int len, err = -1; - if (filename == NULL || linkname == NULL) + if (realname == NULL || filename == NULL || linkname == NULL) goto out_free; len = snprintf(filename, size, "%s%s%s", - debugdir, is_kallsyms ? "/" : "", name); + debugdir, is_kallsyms ? "/" : "", realname); if (mkdir_p(filename, 0755)) goto out_free; @@ -288,7 +289,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, if (is_kallsyms) { if (copyfile("/proc/kallsyms", filename)) goto out_free; - } else if (link(name, filename) && copyfile(name, filename)) + } else if (link(realname, filename) && copyfile(name, filename)) goto out_free; } @@ -305,6 +306,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, if (symlink(targetname, linkname) == 0) err = 0; out_free: + free(realname); free(filename); free(linkname); return err; |