io.c: not shorten buffer unless succeeded

* io.c (io_setstrbuf, io_read): should not shorten the given buffer until
  read succeeds.  [ruby-core:55951] [Bug #8625]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e