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*. Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx> --- sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysctl.c b/sysctl.c index 0c4a630..6613e9a 100644 --- a/sysctl.c +++ b/sysctl.c @@ -579,7 +579,7 @@ static int PreloadSystem(void) || !strcmp(de->d_name, "..")) continue; if (strlen(de->d_name) < 6 - || !strcmp(de->d_name + strlen(de->d_name) - 6, ".conf")) + || strcmp(de->d_name + strlen(de->d_name) - 5, ".conf")) continue; /* check if config already known */ for (i = 0; i < ncfgs; ++i) { -- 1.7.9.7