diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/io/console/console.c | 6 | ||||
-rw-r--r-- | ext/io/console/extconf.rb | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 6c7a31b5e0..2e8f0e387e 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -7,6 +7,8 @@ #include "ruby/io.h" #else #include "rubyio.h" +/* assumes rb_io_t doesn't have pathv */ +#include "util.h" /* for ruby_strdup() */ #endif #ifndef HAVE_RB_IO_T @@ -742,7 +744,11 @@ console_dev(VALUE klass) args[0] = INT2NUM(fd); con = rb_class_new_instance(2, args, klass); GetOpenFile(con, fptr); +#ifdef HAVE_RUBY_IO_H fptr->pathv = rb_obj_freeze(rb_str_new2(CONSOLE_DEVICE)); +#else + fptr->path = ruby_strdup(CONSOLE_DEVICE); +#endif #ifdef CONSOLE_DEVICE_FOR_WRITING GetOpenFile(out, ofptr); # ifdef HAVE_RB_IO_GET_WRITE_IO diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb index 918f86b27f..79f5838c5e 100644 --- a/ext/io/console/extconf.rb +++ b/ext/io/console/extconf.rb @@ -12,6 +12,8 @@ when have_header(hdr = "sgtty.h") else ok = false end +ok &&= enable_config("io-console-force-compatible-with-1.8") || + macro_defined?("HAVE_RUBY_IO_H", "ruby.h") if ok have_header("sys/ioctl.h") have_func("rb_check_hash_type", "ruby.h") |