Skip to content

Commit 3670f5a

Browse files
sapiersapier
sapier
authored and
sapier
committedFeb 7, 2014
Fix invalid check for fread error on extracting zip
1 parent 6715c42 commit 3670f5a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed
 

‎src/script/lua_api/l_mainmenu.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,8 @@ int ModApiMainMenu::l_extract_zip(lua_State *L)
864864

865865
unsigned int bytes_read =
866866
toread->read(read_buffer,sizeof(read_buffer));
867-
unsigned int bytes_written;
868-
if ((bytes_read < 0 ) ||
869-
(bytes_written = fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read))
867+
if ((bytes_read == 0 ) ||
868+
(fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read))
870869
{
871870
fclose(targetfile);
872871
fs->removeFileArchive(fs->getFileArchiveCount()-1);

0 commit comments

Comments
 (0)
Please sign in to comment.