Subject: [PATCH] fix broken tty command on cygwin
From: "Steven O'Brien" <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Tue, 31 Dec 2002 10:01:31 +0000

Hi
The gdb tty option and command is broken on cygwin. After setting a tty
for the inferior, the first run seems OK, but the second sometimes fails
and the third may cause gdb to hang or enter an infinite loop. The fix
is to close the (redundant) tty fd *before* launching the inferior
process instead of after.
This fix is necessary to support anjuta and other gdb interfaces on
cygwin.

Changelog entry:

2002-12-31  Steven O'Brien  <[email-masked]>

	* gdb/win32-nat.c (child_create_inferior): close tty fd before
	launching the inferior process.

Patch:

Index: win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.66
diff -u -p -r1.66 win32-nat.c
--- win32-nat.c	23 Nov 2002 02:49:45 -0000	1.66
+++ win32-nat.c	31 Dec 2002 09:47:00 -0000
@@ -1614,6 +1614,7 @@ child_create_inferior (char *exec_file, 
 	  dup2 (tty, 0);
 	  dup2 (tty, 1);
 	  dup2 (tty, 2);
+	  close (tty);
 	}
     }
 
@@ -1629,7 +1630,6 @@ child_create_inferior (char *exec_file, 
 		       &pi);
   if (tty >= 0)
     {
-      close (tty);
       dup2 (ostdin, 0);
       dup2 (ostdout, 1);
       dup2 (ostderr, 2);

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/