diff options
author | Peter Ammon <corydoras@ridiculousfish.com> | 2012-03-02 00:27:40 -0800 |
---|---|---|
committer | Peter Ammon <corydoras@ridiculousfish.com> | 2012-03-02 00:27:40 -0800 |
commit | 8b26d0104c1d85c271e5ce6e08bfe64a779beba7 (patch) | |
tree | 995568526f190084fd12d74bc6dcd0e828b1018a /exec.cpp | |
parent | 36622c35781c3212c2102c45781a496f3e1b3659 (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.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 ) |