lkml.org 
[lkml]   [2012]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCHv2.5] trace: reuse kbasename() functionality
    Date
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    ---
    kernel/trace/trace_uprobe.c | 8 ++++----
    1 file changed, 4 insertions(+), 4 deletions(-)

    diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
    index 03003cd..c7ba4f6 100644
    --- a/kernel/trace/trace_uprobe.c
    +++ b/kernel/trace/trace_uprobe.c
    @@ -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';
    --
    1.7.10.4


    \
     
     \ /
      Last update: 2012-10-03 11:41    [W:3.570 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site