Subject: Re: [boost] [process] Formal Review
From: Nat Goodspeed (nat_at_[hidden])
Date: 2016-11-07 13:41:14
On Sun, Nov 6, 2016 at 9:38 PM, Gavin Lambert <gavinl_at_[hidden]> wrote:
>>> * On Windows, if you desire to pass any file handles at all to the new
>>> child process, it is completely whimsical what *other* open file
>>> handles you may inadvertently pass -- unless you play games with
>>> STARTUPINFOEXA and PROC_THREAD_ATTRIBUTE_LIST to enumerate exactly the
>>> set of handles you intend to pass.
> FWIW, a slight saving grace with that is that it's most common to open files
> using NULL security attributes, which makes the file non-inherited by
I believe the std::ifstream implementation from Visual Studio 2013 --
the API you use in portable C++ code -- opens files as inheritable by
default. Moreover, this API gives you no opportunity to change their
> You can also flip any existing handle to non-inherited whenever you want.
If your application uses third-party libraries, you have no way to
enumerate the complete set of handles held open by your process.