提交 563b0467 编写于 作者: J J. R. Okajima 提交者: David S. Miller

proc_dointvec: write a single value

The commit 00b7c339
"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: NJ. R. Okajima <hooanon05@yahoo.co.jp>
Reviewed-and-tested-by: NWANG Cong <amwang@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 dd7496f2
...@@ -2253,6 +2253,8 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, ...@@ -2253,6 +2253,8 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
if (write) { if (write) {
left -= proc_skip_spaces(&kbuf); left -= proc_skip_spaces(&kbuf);
if (!left)
break;
err = proc_get_long(&kbuf, &left, &lval, &neg, err = proc_get_long(&kbuf, &left, &lval, &neg,
proc_wspace_sep, proc_wspace_sep,
sizeof(proc_wspace_sep), NULL); sizeof(proc_wspace_sep), NULL);
...@@ -2279,7 +2281,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, ...@@ -2279,7 +2281,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
if (!write && !first && left && !err) if (!write && !first && left && !err)
err = proc_put_char(&buffer, &left, '\n'); err = proc_put_char(&buffer, &left, '\n');
if (write && !err) if (write && !err && left)
left -= proc_skip_spaces(&kbuf); left -= proc_skip_spaces(&kbuf);
free: free:
if (write) { if (write) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册