diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-15 13:50:24 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-15 13:50:24 +0000 |
commit | a9c3f7a19e593ce9c7865890448f84ab9b1fb522 (patch) | |
tree | 013bdcddc9ffa4c2f84e78594d1dbff16e2819df /procps | |
parent | 929930575644fccfae92be39f2cfd0f88cd3dd57 (diff) | |
download | busybox-w32-a9c3f7a19e593ce9c7865890448f84ab9b1fb522.tar.gz busybox-w32-a9c3f7a19e593ce9c7865890448f84ab9b1fb522.tar.bz2 busybox-w32-a9c3f7a19e593ce9c7865890448f84ab9b1fb522.zip |
sysctl: sysctl -a was still misbehaving, fix it
Diffstat (limited to 'procps')
-rw-r--r-- | procps/sysctl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c index 60d9c0afc..860c84062 100644 --- a/procps/sysctl.c +++ b/procps/sysctl.c | |||
@@ -235,8 +235,11 @@ static int sysctl_display_all(const char *path) | |||
235 | 235 | ||
236 | static void sysctl_dots_to_slashes(char *name) | 236 | static void sysctl_dots_to_slashes(char *name) |
237 | { | 237 | { |
238 | char *cptr, *last_good; | 238 | char *cptr, *last_good, *end; |
239 | char *end = name + strlen(name) - 1; | 239 | |
240 | /* It can be good as-is! */ | ||
241 | if (access(name, F_OK) == 0) | ||
242 | return; | ||
240 | 243 | ||
241 | /* Example from bug 3894: | 244 | /* Example from bug 3894: |
242 | * net.ipv4.conf.eth0.100.mc_forwarding -> | 245 | * net.ipv4.conf.eth0.100.mc_forwarding -> |
@@ -246,6 +249,7 @@ static void sysctl_dots_to_slashes(char *name) | |||
246 | * we replaced even one . -> /, start over again, | 249 | * we replaced even one . -> /, start over again, |
247 | * but never replace dots before the position | 250 | * but never replace dots before the position |
248 | * where replacement occurred. */ | 251 | * where replacement occurred. */ |
252 | end = name + strlen(name) - 1; | ||
249 | last_good = name - 1; | 253 | last_good = name - 1; |
250 | again: | 254 | again: |
251 | cptr = end; | 255 | cptr = end; |