sysctl: do slash/dot conversions only on name, not value part
function old new delta sysctl_dots_to_slashes 71 86 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
1422ba6dea
commit
78301861ef
@ -57,6 +57,7 @@ enum {
|
|||||||
static void sysctl_dots_to_slashes(char *name)
|
static void sysctl_dots_to_slashes(char *name)
|
||||||
{
|
{
|
||||||
char *cptr, *last_good, *end;
|
char *cptr, *last_good, *end;
|
||||||
|
char end_ch;
|
||||||
|
|
||||||
/* Convert minimum number of '.' to '/' so that
|
/* Convert minimum number of '.' to '/' so that
|
||||||
* we end up with existing file's name.
|
* we end up with existing file's name.
|
||||||
@ -76,10 +77,11 @@ static void sysctl_dots_to_slashes(char *name)
|
|||||||
*
|
*
|
||||||
* To set up testing: modprobe 8021q; vconfig add eth0 100
|
* To set up testing: modprobe 8021q; vconfig add eth0 100
|
||||||
*/
|
*/
|
||||||
end = name + strlen(name);
|
end = strchrnul(name, '=');
|
||||||
last_good = name - 1;
|
end_ch = *end;
|
||||||
*end = '.'; /* trick the loop into trying full name too */
|
*end = '.'; /* trick the loop into trying full name too */
|
||||||
|
|
||||||
|
last_good = name - 1;
|
||||||
again:
|
again:
|
||||||
cptr = end;
|
cptr = end;
|
||||||
while (cptr > last_good) {
|
while (cptr > last_good) {
|
||||||
@ -96,7 +98,7 @@ static void sysctl_dots_to_slashes(char *name)
|
|||||||
}
|
}
|
||||||
cptr--;
|
cptr--;
|
||||||
}
|
}
|
||||||
*end = '\0';
|
*end = end_ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sysctl_act_on_setting(char *setting)
|
static int sysctl_act_on_setting(char *setting)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user