sysctl: fix another corner case with "dots and slashes"
This commit is contained in:
parent
cb39a7ca6d
commit
501b0e335f
@ -233,6 +233,12 @@ static void sysctl_dots_to_slashes(char *name)
|
|||||||
* we replaced even one . -> /, start over again,
|
* we replaced even one . -> /, start over again,
|
||||||
* but never replace dots before the position
|
* but never replace dots before the position
|
||||||
* where last replacement occurred.
|
* where last replacement occurred.
|
||||||
|
*
|
||||||
|
* Another bug we later had is that
|
||||||
|
* net.ipv4.conf.eth0.100
|
||||||
|
* (without .mc_forwarding) was mishandled.
|
||||||
|
*
|
||||||
|
* To set up testing: modprobe 8021q; vconfig add eth0 100
|
||||||
*/
|
*/
|
||||||
end = name + strlen(name);
|
end = name + strlen(name);
|
||||||
last_good = name - 1;
|
last_good = name - 1;
|
||||||
@ -245,8 +251,8 @@ static void sysctl_dots_to_slashes(char *name)
|
|||||||
*cptr = '\0';
|
*cptr = '\0';
|
||||||
//bb_error_msg("trying:'%s'", name);
|
//bb_error_msg("trying:'%s'", name);
|
||||||
if (access(name, F_OK) == 0) {
|
if (access(name, F_OK) == 0) {
|
||||||
|
if (cptr != end) /* prevent trailing '/' */
|
||||||
*cptr = '/';
|
*cptr = '/';
|
||||||
*end = '\0'; /* prevent trailing '/' */
|
|
||||||
//bb_error_msg("replaced:'%s'", name);
|
//bb_error_msg("replaced:'%s'", name);
|
||||||
last_good = cptr;
|
last_good = cptr;
|
||||||
goto again;
|
goto again;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user