summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/io.c b/io.c
index cb81afd..30f35dc 100644
--- a/io.c
+++ b/io.c
@@ -1608,8 +1608,8 @@ rb_file_s_open(argc, argv, klass)
path = RSTRING(fname)->ptr;
if (FIXNUM_P(vmode)) {
- int flags = FIX2INT(vmode);
- int fmode = NIL_P(perm) ? 0666 : FIX2INT(perm);
+ int flags = NUM2INT(vmode);
+ int fmode = NIL_P(perm) ? 0666 : NUM2INT(perm);
file = rb_file_sysopen_internal(klass, path, flags, fmode);
}
@@ -1649,7 +1649,7 @@ rb_f_open(argc, argv)
mode = "r";
}
else if (FIXNUM_P(pmode)) {
- mode = rb_io_flags_mode(FIX2INT(pmode));
+ mode = rb_io_flags_mode(NUM2INT(pmode));
}
else {
int len;
@@ -1661,6 +1661,7 @@ rb_f_open(argc, argv)
}
port = pipe_open(RSTRING(pname)->ptr+1, mode);
+ if (!rb_iterator_p()) return port;
if (NIL_P(port)) {
rb_yield(port);
}
@@ -3396,4 +3397,7 @@ Init_IO()
#ifdef O_BINARY
rb_file_const("BINARY", INT2FIX(O_BINARY));
#endif
+#ifdef O_SYNC
+ rb_file_const("BINARY", INT2FIX(O_SYNC));
+#endif
}