diff options
author | Ingo Molnar <mingo@elte.hu> | 2011-01-04 02:08:51 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-01-04 02:08:54 -0500 |
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, | |||
270 | const char *name, bool is_kallsyms) | 270 | const char *name, bool is_kallsyms) |
271 | { | 271 | { |
272 | const size_t size = PATH_MAX; | 272 | const size_t size = PATH_MAX; |
273 | char *filename = malloc(size), | 273 | char *realname = realpath(name, NULL), |
274 | *filename = malloc(size), | ||
274 | *linkname = malloc(size), *targetname; | 275 | *linkname = malloc(size), *targetname; |
275 | int len, err = -1; | 276 | int len, err = -1; |
276 | 277 | ||
277 | if (filename == NULL || linkname == NULL) | 278 | if (realname == NULL || filename == NULL || linkname == NULL) |
278 | goto out_free; | 279 | goto out_free; |
279 | 280 | ||
280 | len = snprintf(filename, size, "%s%s%s", | 281 | len = snprintf(filename, size, "%s%s%s", |
281 | debugdir, is_kallsyms ? "/" : "", name); | 282 | debugdir, is_kallsyms ? "/" : "", realname); |
282 | if (mkdir_p(filename, 0755)) | 283 | if (mkdir_p(filename, 0755)) |
283 | goto out_free; | 284 | goto out_free; |
284 | 285 | ||
@@ -288,7 +289,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
288 | if (is_kallsyms) { | 289 | if (is_kallsyms) { |
289 | if (copyfile("/proc/kallsyms", filename)) | 290 | if (copyfile("/proc/kallsyms", filename)) |
290 | goto out_free; | 291 | goto out_free; |
291 | } else if (link(name, filename) && copyfile(name, filename)) | 292 | } else if (link(realname, filename) && copyfile(name, filename)) |
292 | goto out_free; | 293 | goto out_free; |
293 | } | 294 | } |
294 | 295 | ||
@@ -305,6 +306,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
305 | if (symlink(targetname, linkname) == 0) | 306 | if (symlink(targetname, linkname) == 0) |
306 | err = 0; | 307 | err = 0; |
307 | out_free: | 308 | out_free: |
309 | free(realname); | ||
308 | free(filename); | 310 | free(filename); |
309 | free(linkname); | 311 | free(linkname); |
310 | return err; | 312 | return err; |