summaryrefslogtreecommitdiff
path: root/ext/stringio
diff options
context:
space:
mode:
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 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);