Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223546
b: refs/heads/master
c: 68a7a77
h: refs/heads/master
v: v3
  • Loading branch information
Franck Bui-Huu authored and Arnaldo Carvalho de Melo committed Dec 16, 2010
1 parent 43a41b4 commit 660992e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c3a34e06db25a8c74e196517732d65cdb56028ec
refs/heads/master: 68a7a771ad0e2959983729bf88cbc74a7014438f
10 changes: 6 additions & 4 deletions trunk/tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,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;

Expand All @@ -283,7 +284,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;
}

Expand All @@ -300,6 +301,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;
Expand Down

0 comments on commit 660992e

Please sign in to comment.