If fstatat fails, do not access the uninitialized variable st.
Instead, filter the file out.
Basically synchronization with libkmod's conf_files_filter_out.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/230
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
return 1;
}
- fstatat(dirfd(d), name, &st, 0);
+ if (fstatat(dirfd(d), name, &st, 0) < 0) {
+ ERR("Cannot stat directory entry: %s%s\n", dir, name);
+ return 1;
+ }
+
if (S_ISDIR(st.st_mode)) {
ERR("Directories inside directories are not supported: %s/%s\n", dir,
name);