lkml.org 
[lkml]   [2010]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] proc_dointvec, write a single value
    Date
    The commit 00b7c3395aec3df43de5bd02a3c5a099ca51169f
    "sysctl: refactor integer handling proc code"
    modified the behaviour of writing to /proc.
    Before the commit, write("1\n") to /proc/sys/kernel/printk succeeded. But
    now it returns EINVAL.

    This commit supports writing a single value to a multi-valued entry.

    Signed-off-by: J. R. Okajima <hooanon05@yahoo.co.jp>
    ---
    kernel/sysctl.c | 4 +++-
    1 files changed, 3 insertions(+), 1 deletions(-)

    diff --git a/kernel/sysctl.c b/kernel/sysctl.c
    index 4c93486..78ac3fb 100644
    --- a/kernel/sysctl.c
    +++ b/kernel/sysctl.c
    @@ -2262,6 +2262,8 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
    if (write) {
    left -= proc_skip_spaces(&kbuf);

    + if (!left)
    + break;
    err = proc_get_long(&kbuf, &left, &lval, &neg,
    proc_wspace_sep,
    sizeof(proc_wspace_sep), NULL);
    @@ -2288,7 +2290,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,

    if (!write && !first && left && !err)
    err = proc_put_char(&buffer, &left, '\n');
    - if (write && !err)
    + if (write && !err && left)
    left -= proc_skip_spaces(&kbuf);
    free:
    if (write) {
    --
    1.6.6.1


    \
     
     \ /
      Last update: 2010-05-25 08:53    [W:0.038 / U:0.572 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site