lkml.org 
[lkml]   [2013]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -tip v2 1/2] [CLEANUP] perf-probe: Expand given path to absolute path
Em Thu, Dec 26, 2013 at 09:14:46AM -0500, David Ahern escreveu:
> 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.

Changed it to:

pr_warning("Failed to get the absolute path of %s: %m\n", str);


> >+ return ret;
> >+ }
> >+ } else {
> >+ tmp = strdup(str);
> >+ if (!tmp)
> >+ return -ENOMEM;
> >+ }
> >+ params.target = tmp;
>
> When is params.target freed?

> David


\
 
 \ /
  Last update: 2013-12-26 15:41    [W:0.057 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site