Hi Denis,
it is small thing, but IMHO, we can remove line with "if (cptr != end)" or
"*end = '\0';" and retain only one of them. The first has precedence.
*end = '.';
again:
cptr = end;
while (cptr > last_good) {
if (*cptr == '.') {
*cptr = '\0';
if (access(name, F_OK) == 0) {
if (cptr != end) /* prevent trailing '/' by
*end = '\0'; at the end of the loop */
*cptr = '/';
last_good = cptr;
goto again;
}
*cptr = '.';
}
cptr--;
}
*end = '\0'; /* prevents trailing '/' */
Attached is a patch. Thanks.
--
max
diff --git a/procps/sysctl.c b/procps/sysctl.c
index c9063bf..7a5bf14 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -56,8 +56,7 @@ static void sysctl_dots_to_slashes(char *name)
*cptr = '\0';
//bb_error_msg("trying:'%s'", name);
if (access(name, F_OK) == 0) {
- if (cptr != end) /* prevent trailing '/' */
- *cptr = '/';
+ *cptr = '/';
//bb_error_msg("replaced:'%s'", name);
last_good = cptr;
goto again;
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox