diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-25 01:55:22 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-25 01:55:22 +0000 |
commit | 62da750abea80bad64465791e897bcb4c24d5f9a (patch) | |
tree | e7e1c566cb1e645389ba12323902573db8790ba8 | |
parent | 963941b156a38aed362421b6eb6247d1d5c977f0 (diff) | |
download | ruby-62da750abea80bad64465791e897bcb4c24d5f9a.tar.gz |
* include/ruby/win32.h: define mode_t for umask.
* process.c (check_exec_options_i, check_exec_fds, run_exec_options):
support "close_others" only when fork(2) is available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | include/ruby/win32.h | 3 | ||||
-rw-r--r-- | process.c | 8 |
3 files changed, 18 insertions, 0 deletions
@@ -1,3 +1,10 @@ +Fri Apr 25 10:52:27 2008 NAKAMURA Usaku <usa@ruby-lang.org> + + * include/ruby/win32.h: define mode_t for umask. + + * process.c (check_exec_options_i, check_exec_fds, run_exec_options): + support "close_others" only when fork(2) is available. + Fri Apr 25 00:16:11 2008 Tanaka Akira <akr@fsij.org> * process.c: include sys/stat.h for umask. diff --git a/include/ruby/win32.h b/include/ruby/win32.h index 43036b8dc8..4e1f14e9e1 100644 --- a/include/ruby/win32.h +++ b/include/ruby/win32.h @@ -89,6 +89,9 @@ typedef unsigned int uintptr_t; # define _UINTPTR_T_DEFINED # endif #endif +#ifndef __MINGW32__ +# define mode_t int +#endif #ifdef _M_IX86 # define WIN95 1 @@ -1434,6 +1434,7 @@ check_exec_options_i(st_data_t st_key, st_data_t st_val, st_data_t arg) } rb_ary_store(options, EXEC_OPTION_UMASK, LONG2NUM(cmask)); } +#ifdef HAVE_FORK else if (id == rb_intern("close_others")) { if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_CLOSE_OTHERS))) { rb_raise(rb_eArgError, "close_others option specified twice"); @@ -1441,6 +1442,7 @@ check_exec_options_i(st_data_t st_key, st_data_t st_val, st_data_t arg) val = RTEST(val) ? Qtrue : Qfalse; rb_ary_store(options, EXEC_OPTION_CLOSE_OTHERS, val); } +#endif else if (id == rb_intern("in")) { key = INT2FIX(0); goto redirect; @@ -1501,9 +1503,11 @@ check_exec_fds(VALUE options) } } } +#ifdef HAVE_FORK if (RTEST(rb_ary_entry(options, EXEC_OPTION_CLOSE_OTHERS))) { rb_ary_store(options, EXEC_OPTION_CLOSE_OTHERS, INT2FIX(maxhint)); } +#endif return h; } @@ -1843,6 +1847,7 @@ run_exec_dup2(VALUE ary) if (pairs[i].oldfd == -1) continue; if (pairs[i].oldfd == pairs[i].newfd) { /* self cycle */ +#ifdef F_GETFD int fd = pairs[i].oldfd; ret = fcntl(fd, F_GETFD); if (ret == -1) @@ -1853,6 +1858,7 @@ run_exec_dup2(VALUE ary) if (ret == -1) goto fail; } +#endif pairs[i].oldfd = -1; continue; } @@ -2045,10 +2051,12 @@ run_exec_options(const struct rb_exec_arg *e) return -1; } +#ifdef HAVE_FORK obj = rb_ary_entry(options, EXEC_OPTION_CLOSE_OTHERS); if (RTEST(obj)) { rb_close_before_exec(3, FIX2INT(obj), e->redirect_fds); } +#endif obj = rb_ary_entry(options, EXEC_OPTION_OPEN); if (!NIL_P(obj)) { |