From: sapier Date: Fri, 7 Feb 2014 20:29:31 +0000 (+0100) Subject: Fix invalid check for fread error on extracting zip X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=3670f5a37bc3f3eb9733a720e96318e676640185;p=zefram%2Fminetest%2Fminetest_engine.git Fix invalid check for fread error on extracting zip --- diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index ef16efde..1a28c9ba 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -864,9 +864,8 @@ int ModApiMainMenu::l_extract_zip(lua_State *L) unsigned int bytes_read = toread->read(read_buffer,sizeof(read_buffer)); - unsigned int bytes_written; - if ((bytes_read < 0 ) || - (bytes_written = fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read)) + if ((bytes_read == 0 ) || + (fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read)) { fclose(targetfile); fs->removeFileArchive(fs->getFileArchiveCount()-1);