]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
image-discover: skip properly over files that cannot be recognized as image files
authorLennart Poettering <lennart@poettering.net>
Thu, 5 Oct 2023 20:44:50 +0000 (22:44 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 5 Oct 2023 22:23:31 +0000 (23:23 +0100)
Follow-up for: #29364

src/shared/discover-image.c

index 50662037dee256d3e1ef2389584cb0652863f117..e407820e18142986bc21acdf0c9aab41f799997c 100644 (file)
@@ -629,13 +629,14 @@ int image_discover(
                                 r = extract_pretty(de->d_name, image_class_suffix_to_string(class), NULL, &pretty);
                         else if (S_ISBLK(st.st_mode))
                                 r = extract_pretty(de->d_name, NULL, NULL, &pretty);
-                        else
+                        else {
+                                log_debug("Skipping directory entry '%s', which is neither regular file, directory nor block device.", de->d_name);
                                 continue;
-                        if (r < 0)
-                                return r;
-
-                        if (!image_name_is_valid(pretty))
+                        }
+                        if (r < 0) {
+                                log_debug_errno(r, "Skipping directory entry '%s', which doesn't look like an image.", de->d_name);
                                 continue;
+                        }
 
                         if (hashmap_contains(h, pretty))
                                 continue;