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)
20802080static VALUE
20812081ossl_ssl_write_internal (VALUE self , VALUE str , VALUE opts )
20822082{
2083- VALUE args [3 ] = {self , str , opts };
2084- int state ;
2085- str = StringValue (str );
2086-
2083+ StringValue (str );
20872084 int frozen = RB_OBJ_FROZEN (str );
20882085 if (!frozen ) {
2089- str = rb_str_locktmp (str );
2086+ rb_str_locktmp (str );
20902087 }
2088+ int state ;
2089+ VALUE args [3 ] = {self , str , opts };
20912090 VALUE result = rb_protect (ossl_ssl_write_internal_safe , (VALUE )args , & state );
20922091 if (!frozen ) {
20932092 rb_str_unlocktmp (str );
Original file line number Diff line number Diff line change @@ -270,6 +270,11 @@ def test_sysread_and_syswrite
270270 ssl . syswrite ( str )
271271 assert_same buf , ssl . sysread ( str . size , buf )
272272 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 ) )
273278 }
274279 }
275280 end
You can’t perform that action at this time.
0 commit comments