Check if file read is completed

extensions
Volodymyr Shymanskyy 5 years ago
parent 755aef8884
commit 8ce6ce60fd

@ -35,7 +35,9 @@ M3Result repl_load (IM3Runtime runtime, const char* fn)
return "cannot allocate memory for wasm binary"; return "cannot allocate memory for wasm binary";
} }
fread (wasm, 1, fsize, f); if (fread (wasm, 1, fsize, f) != fsize) {
return "cannot read file";
}
fclose (f); fclose (f);
IM3Module module; IM3Module module;
@ -250,7 +252,7 @@ int main (int i_argc, const char* i_argv[])
result = "no such command"; result = "no such command";
} else { } else {
unescape(argv[0]); unescape(argv[0]);
result = repl_call(runtime, argv[0], argc-1, argv+1); result = repl_call(runtime, argv[0], argc-1, (const char**)(argv+1));
} }
if (result) { if (result) {

Loading…
Cancel
Save