summaryrefslogtreecommitdiff
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
commit477dd52c8a0893f3eec844cf21b56f96126e37f6 (patch)
treede5befbc7b3e04197549f029771912cb44a7173b /gas/output-file.c
parenta95a61e053ee2ef972ac8881b05a51fae0253207 (diff)
downloadbinutils-redhat-477dd52c8a0893f3eec844cf21b56f96126e37f6.tar.gz
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 304e90447b..4c376b4dcc 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"));
}