public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org
Subject: [PATCH v2] elfcompress: fix exit status in case of an error
Date: Thu, 13 May 2021 00:52:37 +0300	[thread overview]
Message-ID: <20210512215237.GA9168@altlinux.org> (raw)
In-Reply-To: <YJxE5MabEM5KzgDc@wildebeest.org>

Exit status of 255 in case of an error is probably not what elfcompress
users expect, change it to 1.

Reported-by: Vitaly Chikunov <vt@altlinux.org>
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  <ldv@altlinux.org>
 
+	* 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

  reply	other threads:[~2021-05-12 21:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 16:00 [PATCH] " Dmitry V. Levin
2021-05-12 20:29 ` Mark Wielaard
2021-05-12 20:35   ` Dmitry V. Levin
2021-05-12 21:13     ` Mark Wielaard
2021-05-12 21:52       ` Dmitry V. Levin [this message]
2021-05-13 13:44         ` [PATCH v2] " Mark Wielaard

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=20210512215237.GA9168@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.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).