summaryrefslogtreecommitdiffhomepage
path: root/src/io.c
diff options
context:
space:
mode:
authorksss <[email protected]>2017-05-21 22:52:52 +0900
committerksss <[email protected]>2017-05-21 22:54:12 +0900
commit844b2c368fc4bf852ea1a5f24731ae4bdd6b2331 (patch)
treeebe6ac8fae003210f637fddd4f0f75b874f050b3 /src/io.c
parent6836f424c5ff95d0114a426010b22254804bc9a3 (diff)
downloadmruby-844b2c368fc4bf852ea1a5f24731ae4bdd6b2331.tar.gz
mruby-844b2c368fc4bf852ea1a5f24731ae4bdd6b2331.zip
IO#sysread with 0 always return empty string
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/io.c b/src/io.c
index 51a659f0e..2a24b18a4 100644
--- a/src/io.c
+++ b/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);