www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/06/07/21:16:07

From: cgf AT cygnus DOT com (Christopher G. Faylor)
Subject: Foolproof solution for non-inherit on spawn/exec?
7 Jun 1998 21:16:07 GMT :
Message-ID: <6levun$npa$1@cronkite.cygnus.com>
X-Newsreader: trn 4.0-test63 (15 March 1998)

How about this for a "foolproof" solution to the problem of inheriting handles?
Don't *ever* create an inheritable handle in the fd table.

Create the "linearized" fd table prior to spawning a process but do not
populate it with any handle which has a close-on-exec bit set.  In the spawned
process, the "delinearize" code will do a DuplicateHandle on every handle that
it needs from the parent process.

This scenario means that fds opened in a cygwin process are not passed
to a non-cygwin process.  I think that's the correct behavior.

The only downside that I can see is that it means that process startup is
slightly slower.  It also means that a forked process will also have to
go through this effort.
-- 
cgf AT cygnus DOT com             "Everything has a boolean value, if you stand
http://www.cygnus.com/      far enough away from it."  -- Galena Alyson Canada

- Raw text -


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