aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-07-12 14:42:08 +0000
committerIan Lance Taylor <ian@airs.com>1995-07-12 14:42:08 +0000
commitd1a917c56adbab892b6dca42227ee547056fa5dd (patch)
tree11b2285d740bfe9e0f508e517c75a194b802d266
parent50982f7f9d9436b7f02655c496cedd298ec81ca8 (diff)
downloadgdb-d1a917c56adbab892b6dca42227ee547056fa5dd.zip
gdb-d1a917c56adbab892b6dca42227ee547056fa5dd.tar.gz
gdb-d1a917c56adbab892b6dca42227ee547056fa5dd.tar.bz2
Wed Jul 12 10:40:23 1995 H.J. Lu <hjl@nynexst.com>
* objcopy.c (simple_copy): Preserve errno on failure. (smart_rename): Print error mesage if simple_copy fails.
-rw-r--r--binutils/ChangeLog34
-rw-r--r--binutils/objcopy.c25
2 files changed, 52 insertions, 7 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 2287ec2..0b19373 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,33 @@
+Wed Jul 12 10:40:23 1995 H.J. Lu <hjl@nynexst.com>
+
+ * 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 <jtc@rtl.cygnus.com>
+
+ * 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 <jtc@poseidon.cygnus.com>
+
+ * 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 <ian@cygnus.com>
* nm.c (size_forward): Check yf against yn, not xn.
@@ -76,7 +106,7 @@ Mon Jun 19 09:06:49 1995 Steve Chamberlain <sac@slash.cygnus.com>
* 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 <dje@canuck.cygnus.com>
@@ -90,7 +120,7 @@ Wed Jun 14 13:27:22 1995 Steve Chamberlain <sac@slash.cygnus.com>
Mon Jun 12 11:27:54 1995 Steve Chamberlain <sac@slash.cygnus.com>
* 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 <meissner@tiktok.cygnus.com>
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 0ef9ceb..4d3fb67 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;
}