summaryrefslogtreecommitdiff
path: root/ext/stringio
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-27 11:43:02 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-27 11:43:02 +0000
commitcd453f16b42ea9b68993631b27773165b24ee9b2 (patch)
treea1c01e21da4eb2ff73898ca2deb0bd86f0333386 /ext/stringio
parent90833dd452c0c7276b1dd5a88ab1dd99fbb2d6a5 (diff)
* ext/stringio/stringio.c (strio_ungetc): raise IOError instead of RuntimeError
if the string is frozen. [Bug #7231] [ruby-core:48530] * ext/stringio/stringio.c (strio_ungetbyte): ditto. * test/stringio/test_stringio.rb: a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r--ext/stringio/stringio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index d763854..501c7dd 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -737,6 +737,7 @@ strio_ungetc(VALUE self, VALUE c)
rb_encoding *enc, *enc2;
if (NIL_P(c)) return Qnil;
+ check_modifiable(ptr);
if (FIXNUM_P(c)) {
int cc = FIX2INT(c);
char buf[16];
@@ -801,6 +802,7 @@ strio_ungetbyte(VALUE self, VALUE c)
cl = RSTRING_LEN(c);
if (cl == 0) return Qnil;
}
+ check_modifiable(ptr);
rb_str_modify(str);
if (cl > pos) {
char *s;