diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-16 07:48:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-16 07:48:50 +0000 |
commit | ffa31c264500817f1579be5c6b2d9b943b3b9cf4 (patch) | |
tree | 19eb23e5174693b7107e9bf41c4c8b664186ab38 /ext | |
parent | e7bab2a61b4df0463a094211f5501d8e091391a9 (diff) | |
download | ruby-ffa31c264500817f1579be5c6b2d9b943b3b9cf4.tar.gz |
* ext/stringio/stringio.c (strio_seek): consistent behavior with
IO#seek. patch by sheepman in [ruby-dev:30710].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/stringio/stringio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 969d007f8b..658d923dd6 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -597,6 +597,9 @@ strio_seek(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "11", NULL, &whence); offset = NUM2LONG(argv[0]); + if (CLOSED(ptr)) { + rb_raise(rb_eIOError, "closed stream"); + } switch (NIL_P(whence) ? 0 : NUM2LONG(whence)) { case 0: break; @@ -607,7 +610,7 @@ strio_seek(int argc, VALUE *argv, VALUE self) offset += RSTRING_LEN(ptr->string); break; default: - rb_raise(rb_eArgError, "invalid whence %ld", NUM2LONG(whence)); + error_inval("invalid whence"); } if (offset < 0) { error_inval(0); |