]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
trace: use kbasename()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 9 Nov 2012 03:04:51 +0000 (14:04 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 14 Nov 2012 04:55:14 +0000 (15:55 +1100)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/trace/trace_uprobe.c

index 4ff9ca4f359a45ea08300940809b65c3c2db753d..fa803e61dd470c720a0fb2e651f3c3f1c1148b35 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/uaccess.h>
 #include <linux/uprobes.h>
 #include <linux/namei.h>
+#include <linux/string.h>
 
 #include "trace_probe.h"
 
@@ -263,16 +264,15 @@ static int create_trace_uprobe(int argc, char **argv)
 
        /* setup a probe */
        if (!event) {
-               char *tail = strrchr(filename, '/');
+               char *tail;
                char *ptr;
 
-               ptr = kstrdup((tail ? tail + 1 : filename), GFP_KERNEL);
-               if (!ptr) {
+               tail = kstrdup(kbasename(filename), GFP_KERNEL);
+               if (!tail) {
                        ret = -ENOMEM;
                        goto fail_address_parse;
                }
 
-               tail = ptr;
                ptr = strpbrk(tail, ".-_");
                if (ptr)
                        *ptr = '\0';