sysctl: fix broken .conf suffix matching
There's an off-by-one error in the count (".conf" is 5 bytes, not 6), and the logic is inverted for the strcmp return value -- we want to skip the files when they *don't* end in .conf, not when they *do*. Also fix the off-by-one len check. Bug-Debian: http://bugs.debian.org/669128 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
dbefb4476a
commit
156dd0b5a3
4
sysctl.c
4
sysctl.c
@ -578,8 +578,8 @@ static int PreloadSystem(void)
|
|||||||
if (!strcmp(de->d_name, ".")
|
if (!strcmp(de->d_name, ".")
|
||||||
|| !strcmp(de->d_name, ".."))
|
|| !strcmp(de->d_name, ".."))
|
||||||
continue;
|
continue;
|
||||||
if (strlen(de->d_name) < 6
|
if (strlen(de->d_name) < 5
|
||||||
|| !strcmp(de->d_name + strlen(de->d_name) - 6, ".conf"))
|
|| strcmp(de->d_name + strlen(de->d_name) - 5, ".conf"))
|
||||||
continue;
|
continue;
|
||||||
/* check if config already known */
|
/* check if config already known */
|
||||||
for (i = 0; i < ncfgs; ++i) {
|
for (i = 0; i < ncfgs; ++i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user