From f8c58ebf75335b4465a0e69594bec94cd602e79d Mon Sep 17 00:00:00 2001 From: HellsCoder Date: Sun, 26 Jun 2022 04:17:39 +0800 Subject: [PATCH] fix delete entries fail (#267) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix delete entries fail * Do not close file on zip_file_move error Co-authored-by: Kuba Podgórski --- .gitignore | 1 + src/zip.c | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8a0d755..a5900db 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /build/ /test/build/ /xcodeproj/ +/infer-out/ .vscode/ Testing/ diff --git a/src/zip.c b/src/zip.c index 6adf5bd..f1657e8 100644 --- a/src/zip.c +++ b/src/zip.c @@ -583,20 +583,15 @@ static ssize_t zip_file_move(MZ_FILE *m_pFile, const mz_uint64 to, return ZIP_ECAPSIZE; } if (MZ_FSEEK64(m_pFile, from, SEEK_SET)) { - MZ_FCLOSE(m_pFile); return ZIP_EFSEEK; } - if (fread(move_buf, 1, length, m_pFile) != length) { - MZ_FCLOSE(m_pFile); return ZIP_EFREAD; } if (MZ_FSEEK64(m_pFile, to, SEEK_SET)) { - MZ_FCLOSE(m_pFile); return ZIP_EFSEEK; } if (fwrite(move_buf, 1, length, m_pFile) != length) { - MZ_FCLOSE(m_pFile); return ZIP_EFWRITE; } return (ssize_t)length;