summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-10-15 13:50:24 +0000
committerDenis Vlasenko2008-10-15 13:50:24 +0000
commita9c3f7a19e593ce9c7865890448f84ab9b1fb522 (patch)
tree013bdcddc9ffa4c2f84e78594d1dbff16e2819df
parent929930575644fccfae92be39f2cfd0f88cd3dd57 (diff)
downloadbusybox-a9c3f7a19e593ce9c7865890448f84ab9b1fb522.zip
busybox-a9c3f7a19e593ce9c7865890448f84ab9b1fb522.tar.gz
sysctl: sysctl -a was still misbehaving, fix it
-rw-r--r--procps/sysctl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 60d9c0a..860c840 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -235,8 +235,11 @@ static int sysctl_display_all(const char *path)
static void sysctl_dots_to_slashes(char *name)
{
- char *cptr, *last_good;
- char *end = name + strlen(name) - 1;
+ char *cptr, *last_good, *end;
+
+ /* It can be good as-is! */
+ if (access(name, F_OK) == 0)
+ return;
/* Example from bug 3894:
* net.ipv4.conf.eth0.100.mc_forwarding ->
@@ -246,6 +249,7 @@ static void sysctl_dots_to_slashes(char *name)
* we replaced even one . -> /, start over again,
* but never replace dots before the position
* where replacement occurred. */
+ end = name + strlen(name) - 1;
last_good = name - 1;
again:
cptr = end;