www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/02/15/08:34:33

From: sos AT buggy DOT prospect DOT com DOT ru (Sergey Okhapkin)
Subject: tty.cc fix.
15 Feb 1998 08:34:33 -0800 :
Message-ID: <01BD3A48.D8524AD0.cygnus.cygwin32.developers@sos>
Reply-To: cygwin32-developers AT cygnus DOT com
To: "'cygwin32-developers AT cygnus DOT com'" <cygwin32-developers AT cygnus DOT com>

tty.cc	(fhandler_tty_slave::open): call DuplicateHandle() instead of copying.

f:\cygnus\cdk\winsup>diff -up tty.cc.orig tty.cc
--- tty.cc.orig Wed Feb 11 06:15:20 1998
+++ tty.cc      Sun Feb 15 19:25:22 1998
@@ -924,8 +924,12 @@ fhandler_tty_slave::open (const char *na
       /* We are now the owner of the handles, and anybody who wants to
          open the pty needs to copy them from us, since they are now
          closed in the master.  FIXME: Needs locking.  */
-      ttyp->input_handle = get_handle ();
-      ttyp->output_handle = output_handle_;
+      DuplicateHandle (GetCurrentProcess (), get_handle (),
+                       GetCurrentProcess (), &ttyp->input_handle, 0, TRUE,
+                       DUPLICATE_SAME_ACCESS);
+      DuplicateHandle (GetCurrentProcess (), output_handle_,
+                       GetCurrentProcess (), &ttyp->output_handle, 0, TRUE,
+                       DUPLICATE_SAME_ACCESS);
       ttyp->handle_pid = GetCurrentProcessId ();
       /* We store the number of open slaves + 1 in slave_handles, so
          that we can always tell where the handles are.  */

-- 
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia
Looking for a job

- Raw text -


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