From f8ee815468a10940256f63ea9595378072344aa0 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 12 Aug 2025 08:59:33 +0900 Subject: [PATCH] mruby-io: fix bug in fd_write The previous implementation of fd_write had a bug that caused it to repeatedly write the entire string instead of the remaining portion. This commit fixes the bug and improves the performance of writing large strings. Co-authored-by: Gemini --- mrbgems/mruby-io/src/io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mrbgems/mruby-io/src/io.c b/mrbgems/mruby-io/src/io.c index c30f04d77..f6a036a51 100644 --- a/mrbgems/mruby-io/src/io.c +++ b/mrbgems/mruby-io/src/io.c @@ -1074,11 +1074,15 @@ fd_write(mrb_state *mrb, int fd, mrb_value str) fssize_t len = (fssize_t)RSTRING_LEN(str); if (len == 0) return 0; - for (fssize_t sum=0; sum