From d8bd8e4adc3258b8b7a5eefebdb31da5a239fad3 Mon Sep 17 00:00:00 2001 From: Vitaliy Cherepanov Date: Fri, 23 May 2014 15:18:01 +0400 Subject: [PATCH] [FIX] tasks file add seek able fix problem with symbol at end of string Change-Id: I293b0151574dd29e229152e35835170da114c070 Signed-off-by: Vitaliy Cherepanov --- us_manager/debugfs_us_manager.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/us_manager/debugfs_us_manager.c b/us_manager/debugfs_us_manager.c index 4f682a0..84a0139 100644 --- a/us_manager/debugfs_us_manager.c +++ b/us_manager/debugfs_us_manager.c @@ -34,13 +34,11 @@ static void on_each_proc_callback(struct sspt_proc *proc, void *data) if (rbuf->end - rbuf->ptr < len + 2) return; - if (rbuf->ptr != rbuf->begin) { - *rbuf->ptr = ' '; - ++rbuf->ptr; - } - memcpy(rbuf->ptr, pid_str, len); rbuf->ptr += len; + + *rbuf->ptr = ' '; + ++rbuf->ptr; } static ssize_t read_tasks(struct file *file, char __user *user_buf, @@ -55,8 +53,9 @@ static ssize_t read_tasks(struct file *file, char __user *user_buf, on_each_proc_no_lock(on_each_proc_callback, (void *)&rbuf); - if (rbuf.ptr < rbuf.end) - ++rbuf.ptr; + if (rbuf.ptr != rbuf.begin) + rbuf.ptr--; + *rbuf.ptr = '\n'; return simple_read_from_buffer(user_buf, count, ppos, rbuf.begin, @@ -65,7 +64,8 @@ static ssize_t read_tasks(struct file *file, char __user *user_buf, static const struct file_operations fops_tasks = { .owner = THIS_MODULE, - .read = read_tasks + .read = read_tasks, + .llseek = default_llseek }; /* ============================================================================ -- 2.7.4