From: Ian Lance Taylor Date: Wed, 12 Jul 1995 14:42:08 +0000 (+0000) Subject: Wed Jul 12 10:40:23 1995 H.J. Lu X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d1a917c56adbab892b6dca42227ee547056fa5dd;p=binutils-gdb.git Wed Jul 12 10:40:23 1995 H.J. Lu * objcopy.c (simple_copy): Preserve errno on failure. (smart_rename): Print error mesage if simple_copy fails. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 2287ec28197..0b19373b1cc 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,33 @@ +Wed Jul 12 10:40:23 1995 H.J. Lu + + * objcopy.c (simple_copy): Preserve errno on failure. + (smart_rename): Print error mesage if simple_copy fails. + +Tue Jul 11 13:10:52 1995 J.T. Conklin + + * sysdump.c: re-indented file. + (module): read blocks sequentially instead of trying to parse + them, as that would require changing the parser recognize the + difference between a DPSstart and DPSend block. + (getone): Add break's between switch blocks as appropriate. + (object_body_list): parse blocks according to sysroff spec. + +Mon Jul 10 12:37:25 1995 J.T. Conklin + + * sysroff.info: re-indented file, prior formatting was confusing + because it was indentation did not reflect nesting of conditional + records. Change "space size within segment" record in hd record + from bit to byte. + + * sysinfo.y (cond_it_field): Use xcalloc instead of calloc. + + * srconv.c (wr_cs): Reformatted cs header array, tag each byte + with a comment describing the field. + (wr_unit_info): Use SEEK_SET macro instead of constant 0. + (main): Use FOPEN_WB macro instead of literal "wb". + * sysroff.info: Remove fdl (dfl) field from cs block. Compare + ptr->type with ED_TYPE_CONST instead of constant 2 in ed block. + Tue Jul 4 14:48:42 1995 Ian Lance Taylor * nm.c (size_forward): Check yf against yn, not xn. @@ -76,7 +106,7 @@ Mon Jun 19 09:06:49 1995 Steve Chamberlain * dlltool.c: Change names of generated files. .*.s-> -*.s * objdump.c (dump_section_stabs): Check for names - which are supersets of selected names. binutils/7240. + which are supersets of selected names. Wed Jun 14 19:43:52 1995 Doug Evans @@ -90,7 +120,7 @@ Wed Jun 14 13:27:22 1995 Steve Chamberlain Mon Jun 12 11:27:54 1995 Steve Chamberlain * sysdump.c: Include sysdep.h - (main): Open input with FOPEN_RB. binutils/7137 + (main): Open input with FOPEN_RB. Fri Jun 9 17:26:11 1995 Michael Meissner diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 0ef9cebcdee..4d3fb672744 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -1283,6 +1283,7 @@ simple_copy (from, to) char *from, *to; { int fromfd, tofd, nread; + int saved; char buf[COPY_BUF]; fromfd = open (from, O_RDONLY); @@ -1291,22 +1292,30 @@ simple_copy (from, to) tofd = open (to, O_WRONLY | O_CREAT | O_TRUNC); if (tofd < 0) { + saved = errno; close (fromfd); + errno = saved; return -1; } while ((nread = read (fromfd, buf, sizeof buf)) > 0) { if (write (tofd, buf, nread) != nread) { + saved = errno; close (fromfd); close (tofd); + errno = saved; return -1; } } + saved = errno; close (fromfd); close (tofd); if (nread < 0) - return -1; + { + errno = saved; + return -1; + } return 0; } @@ -1348,7 +1357,7 @@ smart_rename (from, to) { /* We have to clean up here. */ int saved = errno; - fprintf (stderr, "%s: `%s': ", program_name, to); + fprintf (stderr, "%s: %s: ", program_name, to); errno = saved; perror ("rename"); unlink (from); @@ -1357,8 +1366,14 @@ smart_rename (from, to) else { ret = simple_copy (from, to); - if (ret == 0) - unlink (from); + if (ret != 0) + { + int saved = errno; + fprintf (stderr, "%s: %s: ", program_name, to); + errno = saved; + perror ("simple_copy"); + } + unlink (from); } return ret; }