]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwfl_core_file_report: Fix a regression of dwfl_core_file_report retval
authorJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 7 Nov 2013 20:27:54 +0000 (21:27 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 7 Nov 2013 20:27:54 +0000 (21:27 +0100)
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
libdwfl/ChangeLog
libdwfl/core-file.c

index 7f36bdf8ac7ce82094ce7a7316e725ec72f3391d..2355cc5b71a1f065c0719eaab8a94c816f092b35 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * core-file.c (dwfl_core_file_report): Replaced variable sniffed by
+       retval.  Fix one forgotten LISTED increase.
+
 2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Fix core files for re-prelink-ed files.
index 665fcf7a4e664e9c5707bccd7208b30212e82d3b..72a44f86c255814a5e6f8ab4ed55da4913f0a51f 100644 (file)
@@ -483,14 +483,14 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
 
   struct r_debug_info r_debug_info;
   memset (&r_debug_info, 0, sizeof r_debug_info);
-  int listed = dwfl_link_map_report (dwfl, auxv, auxv_size,
+  int retval = dwfl_link_map_report (dwfl, auxv, auxv_size,
                                     dwfl_elf_phdr_memory_callback, elf,
                                     &r_debug_info);
+  int listed = MAX (0, retval);
 
   /* Now sniff segment contents for modules hinted by information gathered
      from DT_DEBUG.  */
 
-  int sniffed = 0;
   ndx = 0;
   do
     {
@@ -506,7 +506,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
       if (seg > ndx)
        {
          ndx = seg;
-         ++sniffed;
+         ++listed;
        }
       else
        ++ndx;
@@ -534,6 +534,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
                                  true, true);
       if (mod == NULL)
        continue;
+      ++listed;
       module->elf = NULL;
       module->fd = -1;
       /* Move this module to the end of the list, so that we end
@@ -560,7 +561,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
   /* We return the number of modules we found if we found any.
      If we found none, we return -1 instead of 0 if there was an
      error rather than just nothing found.  */
-  return sniffed || listed >= 0 ? listed + sniffed : listed;
+  return listed > 0 ? listed : retval;
 }
 INTDEF (dwfl_core_file_report)
 NEW_VERSION (dwfl_core_file_report, ELFUTILS_0.158)