diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-26 05:30:45 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-26 05:30:45 +0000 |
commit | c97c3590530f9742ca0e49d36b3c953763d0224a (patch) | |
tree | 8928826a3416a3ed72e8c4443291747ab4fdddcb /io.c | |
parent | 9e5c4cde2f219f9b37c3885a71faa05531305576 (diff) |
* io.c (rb_io_initialize): [ruby-dev:24962]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -3958,10 +3958,6 @@ rb_io_initialize(argc, argv, io) rb_secure(4); rb_scan_args(argc, argv, "11", &fnum, &mode); - orig = rb_io_check_io(fnum); - if (NIL_P(orig)) { - fd = NUM2INT(fnum); - } if (argc == 2) { if (FIXNUM_P(mode)) { flags = FIX2LONG(mode); @@ -3971,14 +3967,18 @@ rb_io_initialize(argc, argv, io) flags = rb_io_mode_modenum(RSTRING(mode)->ptr); } } + orig = rb_io_check_io(fnum); + if (NIL_P(orig)) { + fd = NUM2INT(fnum); + } 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)); - } + 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 (argc != 2) { #if defined(HAVE_FCNTL) && defined(F_GETFL) flags = fcntl(fd, F_GETFL); if (flags == -1) rb_sys_fail(0); |