summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-26 04:50:36 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-26 04:50:36 +0000
commit9e5c4cde2f219f9b37c3885a71faa05531305576 (patch)
tree6bcbb61d43f1203cd0586e4e3f72d416b6423298 /io.c
parenta052ef75abbf7cc6035083a8af05cf4051ca0110 (diff)
* io.c (rb_io_initialize): should retrieve flags from copying file
descriptor. [ruby-dev:24961] * eval.c (method_missing): raise TypeError for classes do not have allocators. [ruby-core:03752] * lib/erb.rb: [ruby-core:03786] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/io.c b/io.c
index 99cbd1fb53..ef840e9225 100644
--- a/io.c
+++ b/io.c
@@ -3971,11 +3971,13 @@ rb_io_initialize(argc, argv, io)
flags = rb_io_mode_modenum(RSTRING(mode)->ptr);
}
}
- else if (!NIL_P(orig)) {
- GetOpenFile(orig, ofp);
- if (ofp->refcnt == LONG_MAX) {
- VALUE s = rb_inspect(orig);
- rb_raise(rb_eIOError, "too many shared IO for %s", StringValuePtr(s));
+ else {
+ if (!NIL_P(orig)) {
+ GetOpenFile(orig, ofp);
+ if (ofp->refcnt == LONG_MAX) {
+ VALUE s = rb_inspect(orig);
+ rb_raise(rb_eIOError, "too many shared IO for %s", StringValuePtr(s));
+ }
}
#if defined(HAVE_FCNTL) && defined(F_GETFL)
flags = fcntl(fd, F_GETFL);