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 | 3eb48e993ad1f50376660dadcfeeb697e4029940 (patch) | |
tree | 34ef0c65ea16d5901dee585fe675c4fef34e7be8 /ext/stringio | |
parent | fe2900b515df376d1c1f7c7d6d935f7026430374 (diff) |
* 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/branches/ruby_1_8@12180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-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 a64aaf837c..1ae1172be2 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -645,6 +645,9 @@ strio_seek(argc, argv, 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; @@ -655,7 +658,7 @@ strio_seek(argc, argv, self) offset += RSTRING(ptr->string)->len; break; default: - rb_raise(rb_eArgError, "invalid whence %ld", NUM2LONG(whence)); + error_inval("invalid whence"); } if (offset < 0) { error_inval(0); |