IO#sysread with 0 always return empty string
MODIFY
src/io.c
src/io.c
@@ -625,6 +625,9 @@ mrb_io_sysread(mrb_state *mrb, mrb_value io)
if (maxlen < 0) {
return mrb_nil_value();
}
+ else if (maxlen == 0) {
+ return mrb_str_new(mrb, NULL, maxlen);
+ }
if (mrb_nil_p(buf)) {
buf = mrb_str_new(mrb, NULL, maxlen);

MODIFY
test/io.rb
test/io.rb
@@ -234,6 +234,7 @@ assert('IO.sysopen, IO#sysread') do
io.sysread(10000)
end
io.close
+ assert_equal "", io.sysread(0)
io.closed?
end

IO#sysread with 0 always return empty string