free(config);
}
-static bool conf_files_filter_out(struct kmod_ctx *ctx, const char *path,
- const char *fn)
+static bool conf_files_filter_out(struct kmod_ctx *ctx, DIR *d,
+ const char *path, const char *fn)
{
size_t len = strlen(fn);
+ struct stat st;
if (fn[0] == '.')
return 1;
return 1;
}
+ fstatat(dirfd(d), fn, &st, 0);
+
+ if (S_ISDIR(st.st_mode)) {
+ ERR(ctx, "Directories inside directories are not supported: "
+ "%s/%s\n", path, fn);
+ return 1;
+ }
+
return 0;
}
if (entp == NULL)
break;
- if (conf_files_filter_out(ctx, path, entp->d_name) == 1)
+ if (conf_files_filter_out(ctx, d, path, entp->d_name) == 1)
continue;
/* insert sorted */