delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/07/10/08:26:47

From: sos AT prospect DOT com DOT ru (Sergey Okhapkin)
Subject: tty handling fix
10 Jul 1998 08:26:47 -0700 :
Message-ID: <01BDAC32.73828DC0.cygnus.cygwin32.developers@sos>
To: "'cygwin32-developers AT cygnus DOT com'" <cygwin32-developers AT cygnus DOT com>

Hi!

The last winsup snapshot has a bug when tty support is enabled - function 
login() calls open() and sets STD_INPUT_HANDLE to the handle of 
/var/run/utmp file :-)

dcrt0.cc	(dll_crt0_1): call tty_init() before sigproc_init().

hinfo.cc	(set_std_handle): do not set std handles if process is in 
initializing state.



diff -upr /winsup/dcrt0.cc winsup/dcrt0.cc
--- /winsup/dcrt0.cc    Thu Jul 09 00:00:52 1998
+++ winsup/dcrt0.cc     Fri Jul 10 18:25:04 1998
@@ -599,11 +596,11 @@ dll_crt0_1 (per_process *uptr)
       set_console_title (cp);
     }

-  /* Initialize signal/subprocess handling. */
-  sigproc_init ();
-
   /* Connect to tty. */
   tty_init ();
+
+  /* Initialize signal/subprocess handling. */
+  sigproc_init ();

   /* Initialize the file descriptor table. */
   hmap_init ();
diff -upr /winsup/hinfo.cc winsup/hinfo.cc
--- /winsup/hinfo.cc    Tue Jun 09 18:54:54 1998
+++ winsup/hinfo.cc     Fri Jul 10 18:21:59 1998
@@ -317,6 +317,8 @@ hinfo_vec::dup_for_fork (hinfo_vec *chil
 void
 set_std_handle (int fd)
 {
+  if (ISSTATE (myself, PID_INITIALIZING))
+    return;
   if (fd == 0)
     SetStdHandle (STD_INPUT_HANDLE, myself->hmap[fd].h->get_handle ());
   else if (fd == 1)

--
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019