]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: When we find a compressed image, use that, don't search for others
authorMark Wielaard <mark@klomp.org>
Tue, 16 Jun 2020 16:19:45 +0000 (18:19 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 19 Jun 2020 17:03:14 +0000 (19:03 +0200)
We try to find a compressed vmlinux image ending with either .gz, bz2 or
xz. Stop searching if we find one. Otherwise we will leak a file descriptor
for an earlier one we opened.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdwfl/ChangeLog
libdwfl/linux-kernel-modules.c

index 4f1ec9da4c029621ca01332d6509f24b1cf054da..44b3ece77c0c415f4e82798b6f97058ff7a47cee 100644 (file)
@@ -1,3 +1,8 @@
+2020-06-16  Mark Wielaard  <mark@klomp.org>
+
+       * linux-kernel-modules.c (try_kernel_name): Don't try other
+       compressed kernels if we already found an compressed image.
+
 2020-05-09  Mark Wielaard  <mark@klomp.org>
 
        * find-debuginfo.c (dwfl_standard_find_debuginfo): Return failure
index 0434f1e5714bee646a744d6423fa9b025fc9f5b4..84a05f28bd55c855343625205e1acb59c8b13d4e 100644 (file)
@@ -128,7 +128,7 @@ try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug)
 
   if (fd < 0)
     for (size_t i = 0;
-        i < sizeof vmlinux_suffixes / sizeof vmlinux_suffixes[0];
+        i < sizeof vmlinux_suffixes / sizeof vmlinux_suffixes[0] && fd < 0;
         ++i)
       {
        char *zname;