mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
9e5c4cde2f
commit
c97c359053
2 changed files with 14 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Fri Nov 26 14:29:39 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (rb_io_initialize): [ruby-dev:24962]
|
||||||
|
|
||||||
Fri Nov 26 13:49:06 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Fri Nov 26 13:49:06 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (rb_io_initialize): should retrieve flags from copying file
|
* io.c (rb_io_initialize): should retrieve flags from copying file
|
||||||
|
|
20
io.c
20
io.c
|
@ -3958,10 +3958,6 @@ rb_io_initialize(argc, argv, io)
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
rb_scan_args(argc, argv, "11", &fnum, &mode);
|
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 (argc == 2) {
|
||||||
if (FIXNUM_P(mode)) {
|
if (FIXNUM_P(mode)) {
|
||||||
flags = FIX2LONG(mode);
|
flags = FIX2LONG(mode);
|
||||||
|
@ -3971,14 +3967,18 @@ rb_io_initialize(argc, argv, io)
|
||||||
flags = rb_io_mode_modenum(RSTRING(mode)->ptr);
|
flags = rb_io_mode_modenum(RSTRING(mode)->ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
orig = rb_io_check_io(fnum);
|
||||||
|
if (NIL_P(orig)) {
|
||||||
|
fd = NUM2INT(fnum);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (!NIL_P(orig)) {
|
GetOpenFile(orig, ofp);
|
||||||
GetOpenFile(orig, ofp);
|
if (ofp->refcnt == LONG_MAX) {
|
||||||
if (ofp->refcnt == LONG_MAX) {
|
VALUE s = rb_inspect(orig);
|
||||||
VALUE s = rb_inspect(orig);
|
rb_raise(rb_eIOError, "too many shared IO for %s", StringValuePtr(s));
|
||||||
rb_raise(rb_eIOError, "too many shared IO for %s", StringValuePtr(s));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (argc != 2) {
|
||||||
#if defined(HAVE_FCNTL) && defined(F_GETFL)
|
#if defined(HAVE_FCNTL) && defined(F_GETFL)
|
||||||
flags = fcntl(fd, F_GETFL);
|
flags = fcntl(fd, F_GETFL);
|
||||||
if (flags == -1) rb_sys_fail(0);
|
if (flags == -1) rb_sys_fail(0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue