Permalink
Browse files

When closing file descriptors, do not close internal Ruby VM file des…

…criptors. See ruby-core:37759.
  • Loading branch information...
1 parent 279d68d commit e83d4cf6d0c2272e823d7ba690ee3cbb57a415bf @FooBarWidget FooBarWidget committed Aug 2, 2011
Showing with 4 additions and 0 deletions.
  1. +1 −0 ext/ruby/extconf.rb
  2. +3 −0 ext/ruby/passenger_native_support.c
View
@@ -35,6 +35,7 @@
have_header('alloca.h')
have_header('ruby/io.h')
+have_func('rb_reserved_fd_p')
with_cflags($CFLAGS) do
create_makefile('passenger_native_support')
@@ -276,6 +276,9 @@ close_all_file_descriptors(VALUE self, VALUE exceptions) {
for (i = sysconf(_SC_OPEN_MAX) - 1; i >= 0; i--) {
int is_exception = 0;
+ #ifdef HAVE_RB_RESERVED_FD_P
+ is_exception = rb_reserved_fd_p(i);
+ #endif
for (j = 0; j < RARRAY_LEN(exceptions) && !is_exception; j++) {
long fd = NUM2INT(rb_ary_entry(exceptions, j));
is_exception = i == fd;

0 comments on commit e83d4cf

Please sign in to comment.