This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[Bug tools/21522] eu-strip generates empty output if there is nothing to do
- From: "mark at klomp dot org" <sourceware-bugzilla at sourceware dot org>
- To: elfutils-devel at sourceware dot org
- Date: Fri, 02 Jun 2017 13:18:19 +0000
- Subject: [Bug tools/21522] eu-strip generates empty output if there is nothing to do
- Auto-submitted: auto-generated
- References: <bug-21522-10460@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=21522
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at klomp dot org
--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
We seem to never remove the output file if we created it, but couldn't finish
it (either because there is nothing to do or some error occurred). We should
always remove it in that case.
Testing the following:
diff --git a/src/strip.c b/src/strip.c
index f747441..c5dbc9c 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -1063,8 +1063,11 @@ handle_elf (int fd, Elf *elf, const char *prefix, const
char *fname,
/* Test whether we are doing anything at all. */
if (cnt == idx)
- /* Nope, all removable sections are already gone. */
- goto fail_close;
+ {
+ /* Nope, all removable sections are already gone. */
+ result = 1;
+ goto fail_close;
+ }
/* Create the reference to the file with the debug info. */
if (debug_fname != NULL && !remove_shdrs)
@@ -2226,7 +2229,11 @@ cannot set access and modification date of '%s'"),
/* Close the file descriptor if we created a new file. */
if (output_fname != NULL)
- close (fd);
+ {
+ close (fd);
+ if (result != 0)
+ unlink (output_fname);
+ }
return result;
}
--
You are receiving this mail because:
You are on the CC list for the bug.