History

proc_dointvec: write a single value

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.

J. R. Okajima committed 16 years ago

Commit 563b0461 parent dd7496f1 file · +3 −1Browse files

Showing the changes to kernel/sysctl.c (1 of 1 file). Show all

Unified · Split

kernel/sysctl.c+3−1
@@ -2253,6 +2253,8 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, · 2252 unmodified lines
22532253 if (write) {
22542254 left -= proc_skip_spaces(&kbuf);
22552255
2256+ if (!left)
2257+ break;
22562258 err = proc_get_long(&kbuf, &left, &lval, &neg,
22572259 proc_wspace_sep,
22582260 sizeof(proc_wspace_sep), NULL);
@@ -2279,7 +2281,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, · 20 unmodified lines
22792281
22802282 if (!write && !first && left && !err)
22812283 err = proc_put_char(&buffer, &left, '\n');
2282− if (write && !err)
2284+ if (write && !err && left)
22832285 left -= proc_skip_spaces(&kbuf);
22842286 free:
22852287 if (write) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t