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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to