mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
add return value check of fseek
This commit is contained in:
+4
-1
@@ -200,7 +200,10 @@ mrb_file_size(mrb_state *mrb, mrb_value klass)
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
||||
fseek(fp, 0, SEEK_END);
|
||||
if (fseek(fp, 0, SEEK_END) != 0) {
|
||||
mrb_sys_fail(mrb, "mrb_file_size failed.");
|
||||
return mrb_nil_value();
|
||||
}
|
||||
filesize = (mrb_int) ftell(fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
Reference in New Issue
Block a user