delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/03/01/13:25:21

From: cgf AT bbc DOT com (Christopher Faylor)
Subject: Re: Dup2 fix
1 Mar 1998 13:25:21 -0800 :
Message-ID: <Ep5sIw.CA7.cygnus.cygwin32.developers@bbc.com>
References: <01BD456C DOT 03049B60 AT sos>
Reply-To: cgf AT bbc DOT com
To: cygwin32-developers AT cygnus DOT com

In article <01BD456C DOT 03049B60 AT sos>,
Sergey Okhapkin  <sos AT buggy DOT prospect DOT com DOT ru> wrote:
>Christopher Faylor wrote:
>> 
>> I single stepped through cygwin and couldn't find any place that
>> duplicated the flags.  Possibly this is intended to be handled in
>
>hinfo_vec::dup2():
>
>  vec[newfd].item = vec[oldfd].item;

Doh!  You're right.  My patch is hereby withdrawn.

The problem is apparently specifically in tty handling of dup.

In particular there is a line in fhandler_tty_slave::dup() which
specifically sets flags to 0.  I don't think this is the right thing
to do for a dup().

Is there a reason for that line, do you know?  Things seems to work fine
without it.

Unless I'm missing something again, I'd propose the following patch which
also solves my zsh problem:

	patch from cgf AT bbc DOT com (Christopher Faylor)
	* tty.cc (fhandler_tty_slave::dup): Don't set flags to 0.  Flags
	have already been set in wrapper.

*** tty.cc~	Sun Mar 01 16:09:05 1998
--- tty.cc	Sun Mar 01 16:16:01 1998
*************** fhandler_tty_slave::dup (fhandler_base *
*** 1243,1249 ****
    attach_tty (ttynum);
    fts->ttynum = ttynum;
    fts->set_close_on_exec (0);
-   fts->set_flags (0);
  
    const HANDLE proc = GetCurrentProcess ();
    HANDLE nh;
--- 1243,1248 ----
-- 
http://www.bbc.com/	cgf AT bbc DOT com			"Strange how unreal
VMS=>UNIX Solutions	Boston Business Computing	 the real can be."

- Raw text -


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