aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-02-08 16:02:39 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2019-02-08 16:02:39 +0100
commit78301861ef9e8d0edc72898712dbce7d793150a8 (patch)
treefb2d0f38f45d779ddb53930e16146ff9d2dc9520
parent1422ba6dea9160a4b8ad7be9c2cc925c810f1414 (diff)
downloadbusybox-w32-78301861ef9e8d0edc72898712dbce7d793150a8.tar.gz
busybox-w32-78301861ef9e8d0edc72898712dbce7d793150a8.tar.bz2
busybox-w32-78301861ef9e8d0edc72898712dbce7d793150a8.zip
sysctl: do slash/dot conversions only on name, not value part
function old new delta sysctl_dots_to_slashes 71 86 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--procps/sysctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 94a307901..5303460f9 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -57,6 +57,7 @@ enum {
57static void sysctl_dots_to_slashes(char *name) 57static void sysctl_dots_to_slashes(char *name)
58{ 58{
59 char *cptr, *last_good, *end; 59 char *cptr, *last_good, *end;
60 char end_ch;
60 61
61 /* Convert minimum number of '.' to '/' so that 62 /* Convert minimum number of '.' to '/' so that
62 * we end up with existing file's name. 63 * we end up with existing file's name.
@@ -76,10 +77,11 @@ static void sysctl_dots_to_slashes(char *name)
76 * 77 *
77 * To set up testing: modprobe 8021q; vconfig add eth0 100 78 * To set up testing: modprobe 8021q; vconfig add eth0 100
78 */ 79 */
79 end = name + strlen(name); 80 end = strchrnul(name, '=');
80 last_good = name - 1; 81 end_ch = *end;
81 *end = '.'; /* trick the loop into trying full name too */ 82 *end = '.'; /* trick the loop into trying full name too */
82 83
84 last_good = name - 1;
83 again: 85 again:
84 cptr = end; 86 cptr = end;
85 while (cptr > last_good) { 87 while (cptr > last_good) {
@@ -96,7 +98,7 @@ static void sysctl_dots_to_slashes(char *name)
96 } 98 }
97 cptr--; 99 cptr--;
98 } 100 }
99 *end = '\0'; 101 *end = end_ch;
100} 102}
101 103
102static int sysctl_act_on_setting(char *setting) 104static int sysctl_act_on_setting(char *setting)