File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -2080,14 +2080,13 @@ ossl_ssl_write_internal_safe(VALUE _args)
2080
2080
static VALUE
2081
2081
ossl_ssl_write_internal (VALUE self , VALUE str , VALUE opts )
2082
2082
{
2083
- VALUE args [3 ] = {self , str , opts };
2084
- int state ;
2085
- str = StringValue (str );
2086
-
2083
+ StringValue (str );
2087
2084
int frozen = RB_OBJ_FROZEN (str );
2088
2085
if (!frozen ) {
2089
- str = rb_str_locktmp (str );
2086
+ rb_str_locktmp (str );
2090
2087
}
2088
+ int state ;
2089
+ VALUE args [3 ] = {self , str , opts };
2091
2090
VALUE result = rb_protect (ossl_ssl_write_internal_safe , (VALUE )args , & state );
2092
2091
if (!frozen ) {
2093
2092
rb_str_unlocktmp (str );
Original file line number Diff line number Diff line change @@ -270,6 +270,11 @@ def test_sysread_and_syswrite
270
270
ssl . syswrite ( str )
271
271
assert_same buf , ssl . sysread ( str . size , buf )
272
272
assert_equal ( str , buf )
273
+
274
+ obj = Object . new
275
+ obj . define_singleton_method ( :to_str ) { str }
276
+ ssl . syswrite ( obj )
277
+ assert_equal ( str , ssl . sysread ( str . bytesize ) )
273
278
}
274
279
}
275
280
end
You can’t perform that action at this time.
0 commit comments