Commit b2e902f0 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Torvalds

trace: use kbasename()

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f9a00e87
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/uprobes.h> #include <linux/uprobes.h>
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/string.h>
#include "trace_probe.h" #include "trace_probe.h"
...@@ -263,16 +264,15 @@ static int create_trace_uprobe(int argc, char **argv) ...@@ -263,16 +264,15 @@ static int create_trace_uprobe(int argc, char **argv)
/* setup a probe */ /* setup a probe */
if (!event) { if (!event) {
char *tail = strrchr(filename, '/'); char *tail;
char *ptr; char *ptr;
ptr = kstrdup((tail ? tail + 1 : filename), GFP_KERNEL); tail = kstrdup(kbasename(filename), GFP_KERNEL);
if (!ptr) { if (!tail) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail_address_parse; goto fail_address_parse;
} }
tail = ptr;
ptr = strpbrk(tail, ".-_"); ptr = strpbrk(tail, ".-_");
if (ptr) if (ptr)
*ptr = '\0'; *ptr = '\0';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment