From: Jiri Olsa <jolsa@redhat.com>
To: Denys Zagorui <dzagorui@cisco.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, namhyung@kernel.org
Subject: Re: [PATCH v6 2/3] perf tests: avoid storing an absolute path in perf binary
Date: Sun, 23 May 2021 17:58:10 +0200 [thread overview]
Message-ID: <YKp7km95KCUhykig@krava> (raw)
In-Reply-To: <20210521172753.55399-2-dzagorui@cisco.com>
On Fri, May 21, 2021 at 10:27:52AM -0700, Denys Zagorui wrote:
SNIP
> free(cmd);
> +out:
> + free(pythonpath);
> return ret;
> }
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index 3bba74e431ed..53f3dbf02f58 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -22,6 +22,7 @@
> #include "cap.h"
> #include "strlist.h"
> #include "string2.h"
> +#include <libgen.h>
>
> /*
> * XXX We need to find a better place for these things...
> @@ -388,3 +389,14 @@ char *perf_exe(char *buf, int len)
> }
> return strcpy(buf, "perf");
> }
> +
> +char *perf_exe_path(void)
> +{
> + char buf[PATH_MAX];
> + char *dname;
> +
> + perf_exe(buf, PATH_MAX);
> + dname = dirname(buf);
I think this is equally bad.. once you get out of perf_exe_path,
dname might be screwed
> +
> + return dname;
just return strdup(dname) in here?
jirka
next prev parent reply other threads:[~2021-05-23 15:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 17:27 [PATCH v6 1/3] perf report: compile tips.txt in perf binary Denys Zagorui
2021-05-21 17:27 ` [PATCH v6 2/3] perf tests: avoid storing an absolute path " Denys Zagorui
2021-05-23 15:58 ` Jiri Olsa [this message]
2021-05-21 17:27 ` [PATCH v6 3/3] perf parse-events: add bison --file-prefix-map option Denys Zagorui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YKp7km95KCUhykig@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=dzagorui@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox