diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-02-08 16:02:39 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-02-08 16:02:39 +0100 |
commit | 78301861ef9e8d0edc72898712dbce7d793150a8 (patch) | |
tree | fb2d0f38f45d779ddb53930e16146ff9d2dc9520 | |
parent | 1422ba6dea9160a4b8ad7be9c2cc925c810f1414 (diff) | |
download | busybox-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.c | 8 |
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 { | |||
57 | static void sysctl_dots_to_slashes(char *name) | 57 | static 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 | ||
102 | static int sysctl_act_on_setting(char *setting) | 104 | static int sysctl_act_on_setting(char *setting) |