aboutsummaryrefslogtreecommitdiff
path: root/gas/output-file.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-12-19 15:23:41 +0000
committerNick Clifton <nickc@redhat.com>2003-12-19 15:23:41 +0000
commit5a1964ecbd3d7a66c626e2bb5edd7780b99f5aa9 (patch)
treed74dd9613386288ff8eb98abd1c5b449c20b30de /gas/output-file.c
parent10ecffb9b24b79b6a9f373d0c9df0f4c447864a5 (diff)
downloadgdb-5a1964ecbd3d7a66c626e2bb5edd7780b99f5aa9.zip
gdb-5a1964ecbd3d7a66c626e2bb5edd7780b99f5aa9.tar.gz
gdb-5a1964ecbd3d7a66c626e2bb5edd7780b99f5aa9.tar.bz2
Fix calls to as_perror() so that the errno system message will be printed.
Fix as_perror() so that errno is not corrupted.
Diffstat (limited to 'gas/output-file.c')
-rw-r--r--gas/output-file.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/gas/output-file.c b/gas/output-file.c
index 304e904..4c376b4 100644
--- a/gas/output-file.c
+++ b/gas/output-file.c
@@ -1,5 +1,5 @@
/* output-file.c - Deal with the output file
- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001
+ Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -84,10 +84,9 @@ output_file_close (char *filename)
#ifndef BFD_ASSEMBLER
void
-output_file_append (where, length, filename)
- char *where ATTRIBUTE_UNUSED;
- long length ATTRIBUTE_UNUSED;
- char *filename ATTRIBUTE_UNUSED;
+output_file_append (char *where ATTRIBUTE_UNUSED,
+ long length ATTRIBUTE_UNUSED,
+ char *filename ATTRIBUTE_UNUSED)
{
abort ();
}
@@ -98,8 +97,7 @@ output_file_append (where, length, filename)
static FILE *stdoutput;
void
-output_file_create (name)
- char *name;
+output_file_create (char *name)
{
if (name[0] == '-' && name[1] == '\0')
{
@@ -110,17 +108,22 @@ output_file_create (name)
stdoutput = fopen (name, FOPEN_WB);
if (stdoutput == NULL)
{
+#ifdef BFD_ASSEMBLER
+ bfd_set_error (bfd_error_system_call);
+#endif
as_perror (_("FATAL: can't create %s"), name);
exit (EXIT_FAILURE);
}
}
void
-output_file_close (filename)
- char *filename;
+output_file_close (char *filename)
{
if (EOF == fclose (stdoutput))
{
+#ifdef BFD_ASSEMBLER
+ bfd_set_error (bfd_error_system_call);
+#endif
as_perror (_("FATAL: can't close %s"), filename);
exit (EXIT_FAILURE);
}
@@ -130,18 +133,17 @@ output_file_close (filename)
}
void
-output_file_append (where, length, filename)
- char * where;
- long length;
- char * filename;
+output_file_append (char * where, long length, char * filename)
{
for (; length; length--, where++)
{
(void) putc (*where, stdoutput);
if (ferror (stdoutput))
- /* if ( EOF == (putc( *where, stdoutput )) ) */
{
+#ifdef BFD_ASSEMBLER
+ bfd_set_error (bfd_error_system_call);
+#endif
as_perror (_("Failed to emit an object byte"), filename);
as_fatal (_("can't continue"));
}