mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix invalid check for fread error on extracting zip
This commit is contained in:
parent
6715c422ae
commit
3670f5a37b
1 changed files with 2 additions and 3 deletions
|
@ -864,9 +864,8 @@ int ModApiMainMenu::l_extract_zip(lua_State *L)
|
||||||
|
|
||||||
unsigned int bytes_read =
|
unsigned int bytes_read =
|
||||||
toread->read(read_buffer,sizeof(read_buffer));
|
toread->read(read_buffer,sizeof(read_buffer));
|
||||||
unsigned int bytes_written;
|
if ((bytes_read == 0 ) ||
|
||||||
if ((bytes_read < 0 ) ||
|
(fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read))
|
||||||
(bytes_written = fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read))
|
|
||||||
{
|
{
|
||||||
fclose(targetfile);
|
fclose(targetfile);
|
||||||
fs->removeFileArchive(fs->getFileArchiveCount()-1);
|
fs->removeFileArchive(fs->getFileArchiveCount()-1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue