From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 1387B3858426 for ; Fri, 6 Oct 2023 14:40:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1387B3858426 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from r6.localdomain (82-217-174-174.cable.dynamic.v4.ziggo.nl [82.217.174.174]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id D159F30067D1; Fri, 6 Oct 2023 16:40:01 +0200 (CEST) Received: by r6.localdomain (Postfix, from userid 1000) id 894FD3403F9; Fri, 6 Oct 2023 16:40:01 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [COMMITTED] strip: Clean up a bit more after errors Date: Fri, 6 Oct 2023 16:39:52 +0200 Message-ID: <20231006144000.375603-1-mark@klomp.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3033.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- 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