This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Crash on windows hosts


serial_fdopen can return NULL on non-unix (ie. windows) hosts. This was 
causing a segfault in print_flush.
The attached patch fixes this.

Ok?

Paul

2005-04-28  Paul Brook  <paul@codesourcery.com>

	* exceptions.c (print_flush): Handle NULL gdb_stdout_serial.
Index: gdb/exceptions.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gdb/exceptions.c,v
retrieving revision 1.19
diff -u -p -r1.19 exceptions.c
--- gdb/exceptions.c	11 Feb 2005 18:13:49 -0000	1.19
+++ gdb/exceptions.c	28 Apr 2005 01:23:04 -0000
@@ -282,8 +282,11 @@ print_flush (void)
 
   /* 3.  The system-level buffer.  */
   gdb_stdout_serial = serial_fdopen (1);
-  serial_drain_output (gdb_stdout_serial);
-  serial_un_fdopen (gdb_stdout_serial);
+  if (gdb_stdout_serial)
+    {
+      serial_drain_output (gdb_stdout_serial);
+      serial_un_fdopen (gdb_stdout_serial);
+    }
 
   annotate_error_begin ();
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]