aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_mainmenu.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-02-07 21:29:31 +0100
committersapier <Sapier at GMX dot net>2014-02-07 21:29:31 +0100
commit3670f5a37bc3f3eb9733a720e96318e676640185 (patch)
tree8bffa57a359b9c1c4b56cdc5b6147ccde8f881a4 /src/script/lua_api/l_mainmenu.cpp
parent6715c422aecf0e8cb409a3d2cb056a1bffe63446 (diff)
downloadminetest-3670f5a37bc3f3eb9733a720e96318e676640185.tar.gz
minetest-3670f5a37bc3f3eb9733a720e96318e676640185.tar.bz2
minetest-3670f5a37bc3f3eb9733a720e96318e676640185.zip
Fix invalid check for fread error on extracting zip
Diffstat (limited to 'src/script/lua_api/l_mainmenu.cpp')
-rw-r--r--src/script/lua_api/l_mainmenu.cpp5
1 files changed, 2 insertions, 3 deletions
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);