This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH -tip v2 1/2] [CLEANUP] perf-probe: Expand given path to absolute path
- From: David Ahern <dsahern at gmail dot com>
- To: Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>, Ingo Molnar <mingo at kernel dot org>, Arnaldo Carvalho de Melo <acme at ghostprotocols dot net>
- Cc: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>, lkml <linux-kernel at vger dot kernel dot org>, "Steven Rostedt (Red Hat)" <rostedt at goodmis dot org>, Oleg Nesterov <oleg at redhat dot com>, "David A. Long" <dave dot long at linaro dot org>, systemtap at sourceware dot org, yrl dot pp-manager dot tt at hitachi dot com, Namhyung Kim <namhyung at kernel dot org>
- Date: Thu, 26 Dec 2013 09:14:46 -0500
- Subject: Re: [PATCH -tip v2 1/2] [CLEANUP] perf-probe: Expand given path to absolute path
- Authentication-results: sourceware.org; auth=none
- References: <20131226054148 dot 22364 dot 25224 dot stgit at kbuild-fedora dot novalocal> <20131226054150 dot 22364 dot 12187 dot stgit at kbuild-fedora dot novalocal>
On 12/26/13, 12:41 AM, Masami Hiramatsu wrote:
@@ -180,7 +181,20 @@ static int opt_set_target(const struct option *opt, const char *str,
else
return ret;
- params.target = str;
+ /* Expand given path to absolute path, except for modulename */
+ if (params.uprobes || strchr(str, '/')) {
+ tmp = realpath(str, NULL);
+ if (!tmp) {
+ pr_warning("Failed to find the path of %s.\n",
+ str);
That error message will be misleading if it is generated. How about:
Failed to get the absolute path of %s: %d\n", str, errno.
+ return ret;
+ }
+ } else {
+ tmp = strdup(str);
+ if (!tmp)
+ return -ENOMEM;
+ }
+ params.target = tmp;
When is params.target freed?
David