Fix v1 archive decompression

Previous implementation sent too many bytes to decompressor if size was
less than 1024.
This commit is contained in:
Stephen Seo 2024-09-30 15:45:48 +09:00
parent 53fefb7ae8
commit 8fa430f842

View file

@ -2713,8 +2713,10 @@ int simple_archiver_parse_archive_version_1(FILE *in_f, int_fast8_t do_extract,
fprintf(stderr, "ERROR Failed to read chunk for decompressing!\n");
return SDAS_INTERNAL_ERROR;
}
ssize_t write_ret = write(pipe_into_cmd[1], buf, 1024);
if (write_ret > 0 && (size_t)write_ret == 1024) {
ssize_t write_ret =
write(pipe_into_cmd[1], buf, chunk_size - chunk_written);
if (write_ret > 0 &&
(size_t)write_ret == chunk_size - chunk_written) {
// Successful write.
} else if (write_ret == -1) {
fprintf(stderr,