]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
strip: Clean up a bit more after errors
authorMark Wielaard <mark@klomp.org>
Fri, 6 Oct 2023 14:25:56 +0000 (16:25 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 6 Oct 2023 14:25:56 +0000 (16:25 +0200)
In some cases (late) errors would exit early without cleanup.  Set
result to 1 (failure) in those cases and fallthrough.  That way we
cleanup and might provide more hints to the user about what was wrong
with the file.

     * src/strip.c (handle_elf): Set result to 1 and fallthrough
     instead of return 1.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/strip.c

index 2a2cc801b2979c5291a6a6ee88f0f5418478639d..7f4788b331f71a60bd15bb673a94c78265d8e50d 100644 (file)
@@ -2543,8 +2543,7 @@ while computing checksum for debug information"));
     {
       error (0, 0, _("%s: error while creating ELF header: %s"),
             output_fname ?: fname, elf_errmsg (-1));
-      cleanup_debug ();
-      return 1;
+      result = 1;
     }
 
   /* The new section header string table index.  */
@@ -2552,8 +2551,7 @@ while computing checksum for debug information"));
     {
       error (0, 0, _("%s: error updating shdrstrndx: %s"),
             output_fname ?: fname, elf_errmsg (-1));
-      cleanup_debug ();
-      return 1;
+      result = 1;
     }
 
   /* We have everything from the old file.  */
@@ -2561,8 +2559,7 @@ while computing checksum for debug information"));
     {
       error (0, 0, _("%s: error while reading the file: %s"),
             fname, elf_errmsg (-1));
-      cleanup_debug ();
-      return 1;
+      result = 1;
     }
 
   /* The ELF library better follows our layout when this is not a