aboutsummaryrefslogtreecommitdiff
path: root/gas/output-file.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2006-09-27 11:14:59 +0000
committerNick Clifton <nickc@redhat.com>2006-09-27 11:14:59 +0000
commitdf3ca5a38ec2bdf53f5f42abb1a4b376ba414302 (patch)
treece808b250d4ccb1503bab680c0bf870c6e07c48f /gas/output-file.c
parent49c13adb16c432e9d04770f7c6b8348e31bb1df1 (diff)
downloadgdb-df3ca5a38ec2bdf53f5f42abb1a4b376ba414302.zip
gdb-df3ca5a38ec2bdf53f5f42abb1a4b376ba414302.tar.gz
gdb-df3ca5a38ec2bdf53f5f42abb1a4b376ba414302.tar.bz2
* output-file.c (output_file_close): Prevent an infinite loop reporting that stdoutput could not be closed.
Diffstat (limited to 'gas/output-file.c')
-rw-r--r--gas/output-file.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gas/output-file.c b/gas/output-file.c
index dfbef1f..9603dc4 100644
--- a/gas/output-file.c
+++ b/gas/output-file.c
@@ -53,9 +53,19 @@ output_file_create (char *name)
void
output_file_close (char *filename)
{
+ bfd_boolean res;
+
+ if (stdoutput == NULL)
+ return;
+
/* Close the bfd. */
- if (!bfd_close (stdoutput))
+ res = bfd_close (stdoutput);
+
+ /* Prevent an infinite loop - if the close failed we will call as_fatal
+ which will call xexit() which may call this function again... */
+ stdoutput = NULL;
+
+ if (! res)
as_fatal (_("can't close %s: %s"), filename,
bfd_errmsg (bfd_get_error ()));
- stdoutput = NULL; /* Trust nobody! */
}