Add validation of files/symlinks count from files
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 6s

This commit is contained in:
Stephen Seo 2024-10-08 15:31:40 +09:00
parent 28c09b0232
commit 78ba5acd70

View file

@ -1861,6 +1861,13 @@ int simple_archiver_write_v1(FILE *out_f, SDArchiverState *state,
simple_archiver_priority_heap_free(&files_pheap);
}
if (symlinks_list->count + files_list->count != filenames->count) {
fprintf(stderr,
"ERROR: Count mismatch between files and symlinks and files from "
"parser!\n");
return SDAS_INTERNAL_ERROR;
}
if (fwrite("SIMPLE_ARCHIVE_VER", 1, 18, out_f) != 18) {
return SDAS_FAILED_TO_WRITE;
}