From: sapier Date: Fri, 7 Feb 2014 20:29:31 +0000 (+0100) Subject: Fix invalid check for fread error on extracting zip X-Git-Tag: 0.4.10~274 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3670f5a37bc3f3eb9733a720e96318e676640185;p=oweals%2Fminetest.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 ef16efde2..1a28c9ba0 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);