* [PATCH] objcopy should delete its output on error
@ 2005-04-26 14:00 Jan Beulich
2005-05-05 10:48 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2005-04-26 14:00 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 1479 bytes --]
Built and tested on i686-pc-linux-gnu.
Jan
binutils/
2005-04-26 Jan Beulich <jbeulich@novell.com>
* objcopy.c (copy_file): Don't delete output upon error here.
(copy_main): Delete output upon error.
--- /home/jbeulich/src/binutils/mainline/2005-04-26/binutils/objcopy.c 2005-04-26 15:08:08.000000000 +0200
+++ 2005-04-26/binutils/objcopy.c 2005-04-26 15:43:14.000000000 +0200
@@ -1731,7 +1731,6 @@ copy_file (const char *input_filename, c
else if (bfd_check_format_matches (ibfd, bfd_object, &obj_matching))
{
bfd *obfd;
- bfd_boolean delete;
do_copy:
/* bfd_get_target does not return the correct value until
@@ -1743,7 +1742,8 @@ copy_file (const char *input_filename, c
if (obfd == NULL)
RETURN_NONFATAL (output_filename);
- delete = ! copy_object (ibfd, obfd);
+ if (! copy_object (ibfd, obfd))
+ status = 1;
if (!bfd_close (obfd))
RETURN_NONFATAL (output_filename);
@@ -1751,11 +1751,6 @@ copy_file (const char *input_filename, c
if (!bfd_close (ibfd))
RETURN_NONFATAL (input_filename);
- if (delete)
- {
- unlink_if_ordinary (output_filename);
- status = 1;
- }
}
else
{
@@ -3054,6 +3049,8 @@ copy_main (int argc, char *argv[])
if (status == 0 && preserve_dates)
set_times (output_filename, &statbuf);
+ else if (status != 0)
+ unlink_if_ordinary (output_filename);
}
if (change_warn)
[-- Attachment #2: binutils-mainline-objcopy-del-output.patch --]
[-- Type: text/plain, Size: 1424 bytes --]
Built and tested on i686-pc-linux-gnu.
Jan
binutils/
2005-04-26 Jan Beulich <jbeulich@novell.com>
* objcopy.c (copy_file): Don't delete output upon error here.
(copy_main): Delete output upon error.
--- /home/jbeulich/src/binutils/mainline/2005-04-26/binutils/objcopy.c 2005-04-26 15:08:08.000000000 +0200
+++ 2005-04-26/binutils/objcopy.c 2005-04-26 15:43:14.000000000 +0200
@@ -1731,7 +1731,6 @@ copy_file (const char *input_filename, c
else if (bfd_check_format_matches (ibfd, bfd_object, &obj_matching))
{
bfd *obfd;
- bfd_boolean delete;
do_copy:
/* bfd_get_target does not return the correct value until
@@ -1743,7 +1742,8 @@ copy_file (const char *input_filename, c
if (obfd == NULL)
RETURN_NONFATAL (output_filename);
- delete = ! copy_object (ibfd, obfd);
+ if (! copy_object (ibfd, obfd))
+ status = 1;
if (!bfd_close (obfd))
RETURN_NONFATAL (output_filename);
@@ -1751,11 +1751,6 @@ copy_file (const char *input_filename, c
if (!bfd_close (ibfd))
RETURN_NONFATAL (input_filename);
- if (delete)
- {
- unlink_if_ordinary (output_filename);
- status = 1;
- }
}
else
{
@@ -3054,6 +3049,8 @@ copy_main (int argc, char *argv[])
if (status == 0 && preserve_dates)
set_times (output_filename, &statbuf);
+ else if (status != 0)
+ unlink_if_ordinary (output_filename);
}
if (change_warn)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-05 10:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-26 14:00 [PATCH] objcopy should delete its output on error Jan Beulich
2005-05-05 10:48 ` Nick Clifton
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).