]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: convert a should-be-unreachable LOG to an ERR
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 18 Jul 2026 14:25:32 +0000 (15:25 +0100)
committerLucas De Marchi <ldemarchi@kernel.org>
Tue, 28 Jul 2026 14:11:03 +0000 (09:11 -0500)
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>
testsuite/delete_module.c

index 46fffb91f6cff071a33e008e4c2ebdeb0d41ad1c..0ed172eb02bcb6d09810adb514964cc890b849b5 100644 (file)
@@ -130,8 +130,8 @@ static int remove_directory(const char *path)
        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);