strip: Don't generate empty output file when nothing to do.
authorMark Wielaard <mark@klomp.org>
Wed, 7 Jun 2017 18:32:38 +0000 (20:32 +0200)
committerMark Wielaard <mark@klomp.org>
Wed, 14 Jun 2017 12:51:33 +0000 (14:51 +0200)
commitb58aebe71e0b4863db1b7fd3e942e36303257f3a
treeb35449ab65eef87b6645130e5a86c5f8be4725c6
parente0b3232e9a0bc8215ca1be29b1ec6df43811eb87
strip: Don't generate empty output file when nothing to do.

If there was nothing to do strip would skip generating a separate
debug file if one was requested, but it would also not finish the
creation of a new output file (with the non-stripped sections).
Also if there was an error any partially created output would be kept.

Make sure that when the -o output file option is given we always generate
a complete output file (except on error). Also make sure that when the -f
debug file option is given it is only generated when it is not empty.

Add testcase run-strip-nothing.sh that tests the various combinations.

https://sourceware.org/bugzilla/show_bug.cgi?id=21522

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/strip.c
tests/ChangeLog
tests/Makefile.am
tests/run-strip-nothing.sh [new file with mode: 0755]