Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zip_close fails after delete entries #266

Closed
HellsCoder opened this issue Jun 18, 2022 · 1 comment
Closed

zip_close fails after delete entries #266

HellsCoder opened this issue Jun 18, 2022 · 1 comment

Comments

@HellsCoder
Copy link
Contributor

Clear empty files in archive function, and zip_close after execute function fail

struct zip_t* zip = zip_open(LU_LOG_PATH, 0, 'd');
int count = zip_entries_total(zip);
char* entries[50];
int entryIndex = 0;
for (int i = 0; i < count; i++) {
zip_entry_openbyindex(zip, i);
  if (zip->entry.uncomp_size <= 0) {
	  char* entryReplaced = zip->entry.name;
	  entries[entryIndex] = malloc(MAX_PATH);
	  memcpy(entries[entryIndex], entryReplaced, strlen(entryReplaced) + 1);
	  entryIndex++;
  }
}
zip_entries_delete(zip, entries, entryIndex);
ftell(zip->archive.m_pState->m_pFile); //<-- ftell fails... zip->archive.m_pState->m_pFile was closed
zip_close(zip);; //<-- zip_close fails by fails _ftelli64, because file stream is closed
@HellsCoder
Copy link
Contributor Author

Modify zip.c for bypass this problem #267

@kuba-- kuba-- closed this as completed Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants