[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: =?us-ascii?Q?=5BPATH=5D=20sysctl=3A=20=27sysctl=5Fdots=5Fto=5Fslashes=27=20does=20not=20give=20calmn
From: Maxim Kry¾anovskı <xmaks () email ! cz>
Date: 2010-03-25 10:59:37
Message-ID: 4836.1826.2476-18936-1023947752-1269514777 () email ! cz
[Download RAW message or body]
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
["=?us-ascii?Q?sysctl=2Epatch?=" (text/x-patch)]
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
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic