Of the two call-sites to remove_directory() we have:
- we explicitly stat/S_ISDIR check prior, and
- the folder must exist, or out init_module.c implementation is broken
Thus is seems very unlikely to trigger the LOG and in practice, it
indicates a bug/race condition. Convert it to an ERR and return -1 to
indicate that.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
char full_path[PATH_MAX];
if (stat(path, &st) != 0 || !S_ISDIR(st.st_mode)) {
- LOG("Directory %s not found, skip remove.\n", path);
- return 0;
+ ERR("Directory %s not found, skip remove.\n", path);
+ return -1;
}
dir = opendir(path);