[PATCH 1/2] elfcompress: fix exit status in case of "Nothing to do"

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


When elfcompress decides that no section data needs to be updated and
therefore the file does not have to be rewritten, it still has to exit
with a zero status indicating success.

Resolves: https://sourceware.org/bugzilla/show_bug.cgi?id=27856
Fixes: ed62996defc6 ("elfcompress: Don't rewrite file if no section data needs to be updated.")
---
 src/ChangeLog     | 4 ++++
 src/elfcompress.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index c5ecc05b..47c7eb79 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-12  Dmitry V. Levin  <ldv@altlinux.org>
+
+	* elfcompress.c (process_file): Set res to 0 in case of "Nothing to do".
+
 2021-04-19  Martin Liska  <mliska@suse.cz>
 
 	* elfclassify.c (run_classify): Use startswith.
diff --git a/src/elfcompress.c b/src/elfcompress.c
index d5bc3300..7340e878 100644
--- a/src/elfcompress.c
+++ b/src/elfcompress.c
@@ -522,6 +522,7 @@ process_file (const char *fname)
       if (verbose > 0)
 	printf ("Nothing to do.\n");
       fnew = NULL;
+      res = 0;
       goto cleanup;
     }
 
-- 
ldv


More information about the Elfutils-devel mailing list