[前][次][番号順一覧][スレッド一覧]

ruby-changes:37684

From: nobu <ko1@a...>
Date: Fri, 27 Feb 2015 12:55:13 +0900 (JST)
Subject: [ruby-changes:37684] nobu:r49765 (trunk): io.c: discard buffer always

nobu	2015-02-27 12:54:54 +0900 (Fri, 27 Feb 2015)

  New Revision: 49765

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49765

  Log:
    io.c: discard buffer always
    
    * io.c (copy_stream_fallback_body): discard buffer always before
      exit or exception.

  Modified files:
    trunk/io.c
Index: io.c
===================================================================
--- io.c	(revision 49764)
+++ io.c	(revision 49765)
@@ -10462,11 +10462,11 @@ copy_stream_fallback_body(VALUE arg) https://github.com/ruby/ruby/blob/trunk/io.c#L10462
             ssize_t ss;
             rb_str_resize(buf, buflen);
             ss = maygvl_copy_stream_read(1, stp, RSTRING_PTR(buf), l, off);
+            rb_str_resize(buf, ss > 0 ? ss : 0);
             if (ss == -1)
                 return Qnil;
             if (ss == 0)
                 rb_eof_error();
-            rb_str_resize(buf, ss);
             if (off != (off_t)-1)
                 off += ss;
         }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]