public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [COMMITTED] strip: Clean up a bit more after errors
Date: Fri,  6 Oct 2023 16:39:52 +0200	[thread overview]
Message-ID: <20231006144000.375603-1-mark@klomp.org> (raw)

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 | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/strip.c b/src/strip.c
index 2a2cc801..7f4788b3 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -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
-- 
2.41.0


                 reply	other threads:[~2023-10-06 14:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231006144000.375603-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).