mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-io (mrb_file_s_readlink): when rc == bufsize, rc never be -1
This commit is contained in:
@@ -768,7 +768,7 @@ mrb_file_s_readlink(mrb_state *mrb, mrb_value klass)
|
||||
tmp = mrb_locale_from_utf8(path, -1);
|
||||
|
||||
buf = (char*)mrb_malloc(mrb, bufsize);
|
||||
while ((rc = readlink(tmp, buf, bufsize)) == (ssize_t)bufsize && rc != -1) {
|
||||
while ((rc = readlink(tmp, buf, bufsize)) == (ssize_t)bufsize) {
|
||||
bufsize *= 2;
|
||||
buf = (char*)mrb_realloc(mrb, buf, bufsize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user