From 3670f5a37bc3f3eb9733a720e96318e676640185 Mon Sep 17 00:00:00 2001 From: sapier Date: Fri, 7 Feb 2014 21:29:31 +0100 Subject: Fix invalid check for fread error on extracting zip --- src/script/lua_api/l_mainmenu.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/script/lua_api') 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); -- cgit v1.2.3