Skip to content

Commit

Permalink
proc_dointvec: write a single value
Browse files Browse the repository at this point in the history
The commit 00b7c33
"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>
Reviewed-and-tested-by: WANG Cong <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
J. R. Okajima authored and davem330 committed May 25, 2010
1 parent dd7496f commit 563b046
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2253,6 +2253,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);
Expand All @@ -2279,7 +2281,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) {
Expand Down

0 comments on commit 563b046

Please sign in to comment.