mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
IO#sysread with 0 always return empty string
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -234,6 +234,7 @@ assert('IO.sysopen, IO#sysread') do
|
||||
io.sysread(10000)
|
||||
end
|
||||
io.close
|
||||
assert_equal "", io.sysread(0)
|
||||
io.closed?
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user