summaryrefslogtreecommitdiffstats
path: root/ext/stringio
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-16 07:48:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-16 07:48:50 +0000
commit4c7bc4855756f40f36dc9cfed83f39c3f401ad61 (patch)
tree19eb23e5174693b7107e9bf41c4c8b664186ab38 /ext/stringio
parent1f27e8c17c748e7d4a93e1b119c69965f4b86e5b (diff)
downloadruby-4c7bc4855756f40f36dc9cfed83f39c3f401ad61.tar.gz
ruby-4c7bc4855756f40f36dc9cfed83f39c3f401ad61.tar.xz
ruby-4c7bc4855756f40f36dc9cfed83f39c3f401ad61.zip
* ext/stringio/stringio.c (strio_seek): consistent behavior with
IO#seek. patch by sheepman in [ruby-dev:30710]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r--ext/stringio/stringio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 969d007f8..658d923dd 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);