delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/11/13/18:23:26

From: corinna DOT vinschen AT cityweb DOT de (Corinna Vinschen)
Subject: Error in dup???
13 Nov 1998 18:23:26 -0800 :
Message-ID: <364CE31A.71A3E6F0.cygnus.cygwin32.developers@cityweb.de>
Mime-Version: 1.0
To: cygwin32-developers AT cygnus DOT com

Hello!

Interesting effect:

tcsh does a lot of dup()-calls. The following code in tcsh:

	...
	close(0);
	(void) dup(foo_fd);
	...

doesn't create fd == 0 but something like 55 or else. This only
happens, if tcsh is a subshell. If tcsh is the login shell,
anything works. And, for test purposes, I have substituted the
above code by:

	...
	close(0);
	(void) dup2(foo_fd, 0);
	...

and it did it as expected! The new fd is 0 in subshells, too.

It happens in tty and notty mode.

Seems to be a problem in dup().
Any idea?

Corinna

- Raw text -


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