From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id 46927385381A for ; Wed, 12 May 2021 21:52:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 46927385381A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ldv@altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id BE18C72C8B4; Thu, 13 May 2021 00:52:37 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id AC48A7CC67A; Thu, 13 May 2021 00:52:37 +0300 (MSK) Date: Thu, 13 May 2021 00:52:37 +0300 From: "Dmitry V. Levin" To: Mark Wielaard Cc: elfutils-devel@sourceware.org Subject: [PATCH v2] elfcompress: fix exit status in case of an error Message-ID: <20210512215237.GA9168@altlinux.org> References: <20210512160000.GA3462@altlinux.org> <20210512203527.GA7746@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 21:52:39 -0000 Exit status of 255 in case of an error is probably not what elfcompress users expect, change it to 1. Reported-by: Vitaly Chikunov Fixes: 92acb57eb046 ("elfcompress: New utility.") --- src/ChangeLog | 3 +++ src/elfcompress.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index de130f79..2c7be185 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2021-05-12 Dmitry V. Levin + * elfcompress.c (process_file): Return 1 instead of -1 in case of an + error. + * elfcompress.c (process_file): Remove redundant assignment in case of "Nothing to do". diff --git a/src/elfcompress.c b/src/elfcompress.c index 05f3bc2c..2c6d91ba 100644 --- a/src/elfcompress.c +++ b/src/elfcompress.c @@ -298,7 +298,7 @@ process_file (const char *fname) /* How many sections are we talking about? */ size_t shnum = 0; - int res = -1; + int res = 1; fd = open (fname, O_RDONLY); if (fd < 0) -- ldv