aboutsummaryrefslogtreecommitdiffhomepage
path: root/exec.cpp
diff options
context:
space:
mode:
authorGravatar Peter Ammon <corydoras@ridiculousfish.com>2012-03-02 00:27:40 -0800
committerGravatar Peter Ammon <corydoras@ridiculousfish.com>2012-03-02 00:27:40 -0800
commit8b26d0104c1d85c271e5ce6e08bfe64a779beba7 (patch)
tree995568526f190084fd12d74bc6dcd0e828b1018a /exec.cpp
parent36622c35781c3212c2102c45781a496f3e1b3659 (diff)
Some initial changes to use CLO_EXEC, with an eye towards some day using it correctly.
Diffstat (limited to 'exec.cpp')
-rw-r--r--exec.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/exec.cpp b/exec.cpp
index d7f0e0b6..1dfad6f7 100644
--- a/exec.cpp
+++ b/exec.cpp
@@ -198,6 +198,7 @@ void close_unused_internal_pipes( io_data_t *io )
*/
static char *get_interpreter( const char *command, char *interpreter, size_t buff_size )
{
+ // OK to not use CLO_EXEC here because this is only called after fork
int fd = open( command, O_RDONLY );
if( fd >= 0 )
{
@@ -248,6 +249,7 @@ static void safe_launch_process( process_t *p, const char *actual_cmd, char **ar
/bin/sh if encountered. This is a weird predecessor to the shebang
that is still sometimes used since it is supported on Windows.
*/
+ /* OK to not use CLO_EXEC here because this is called after fork and the file is immediately closed */
int fd = open(actual_cmd, O_RDONLY);
if (fd >= 0)
{
@@ -414,6 +416,7 @@ static void io_untransmogrify( io_data_t * in, io_data_t *out )
*/
static io_data_t *io_transmogrify( io_data_t * in )
{
+ ASSERT_IS_MAIN_THREAD();
if( !in )
return 0;
@@ -876,6 +879,7 @@ void exec( parser_t &parser, job_t *j )
case IO_FILE:
{
+ /* Do not set CLO_EXEC because child needs access */
builtin_stdin=wopen( in->filename,
in->param2.flags, OPEN_MASK );
if( builtin_stdin == -1 )