[PATCH] elfcompress: fix exit status in case of an error

Dmitry V. Levin ldv@altlinux.org
Wed May 12 16:00:00 GMT 2021


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     | 2 ++
 src/elfcompress.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index de130f79..bc6ffc87 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,7 @@
 2021-05-12  Dmitry V. Levin  <ldv@altlinux.org>
 
+	* elfcompress.c (main): 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..dacaff32 100644
--- a/src/elfcompress.c
+++ b/src/elfcompress.c
@@ -1358,5 +1358,5 @@ main (int argc, char **argv)
   while (++remaining < argc);
 
   free_patterns ();
-  return result;
+  return !!result;
 }
-- 
ldv


More information about the Elfutils-devel mailing list