* MAINTAINERS: Add myself under Write After Approval.
[deliverable/binutils-gdb.git] / gdb / ui-file.c
index 9a1d892b132b14e7e0b74e6ac4aa636fb823db26..527917c414fe8872c8180af623e4dca1afa82b65 100644 (file)
@@ -1,6 +1,6 @@
 /* UI_FILE - a generic STDIO like output stream.
 
-   Copyright (C) 1999, 2000, 2001, 2002, 2007, 2008
+   Copyright (C) 1999, 2000, 2001, 2002, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -285,8 +285,7 @@ do_ui_file_xstrdup (void *context, const char *buffer, long length)
 }
 
 char *
-ui_file_xstrdup (struct ui_file *file,
-                 long *length)
+ui_file_xstrdup (struct ui_file *file, long *length)
 {
   struct accumulated_ui_file acc;
   acc.buffer = NULL;
@@ -294,7 +293,8 @@ ui_file_xstrdup (struct ui_file *file,
   ui_file_put (file, do_ui_file_xstrdup, &acc);
   if (acc.buffer == NULL)
     acc.buffer = xstrdup ("");
-  *length = acc.length;
+  if (length != NULL)
+    *length = acc.length;
   return acc.buffer;
 }
 \f
@@ -481,7 +481,9 @@ stdio_file_write (struct ui_file *file, const char *buf, long length_buf)
   if (stdio->magic != &stdio_file_magic)
     internal_error (__FILE__, __LINE__,
                    _("stdio_file_write: bad magic number"));
-  fwrite (buf, length_buf, 1, stdio->file);
+  /* Calling error crashes when we are called from the exception framework.  */
+  if (fwrite (buf, length_buf, 1, stdio->file))
+    ;
 }
 
 static void
@@ -491,7 +493,9 @@ stdio_file_fputs (const char *linebuffer, struct ui_file *file)
   if (stdio->magic != &stdio_file_magic)
     internal_error (__FILE__, __LINE__,
                    _("stdio_file_fputs: bad magic number"));
-  fputs (linebuffer, stdio->file);
+  /* Calling error crashes when we are called from the exception framework.  */
+  if (fputs (linebuffer, stdio->file))
+    ;
 }
 
 static int
This page took 0.024186 seconds and 4 git commands to generate.