Tweak the ARCHIVE_OK/len=0 handling
If this can happen once, it can happen twice, and it seems unsafe to not
handle that case.
@@ -183,12 +183,13 @@ static int read_callback(struct fun_context *fctx, const void **buffer, size_t *
// off_t could be 32-bits so offset can't be passed directly to archive_read_data_block
int64_t offset64 = 0;
- int rc = archive_read_data_block(p->a, buffer, len, &offset64);
+ int rc;
// Handle case where archive_read_data_block returns a 0 byte read
// even though it's not at end of file. A second read gets past this.
- if (rc == ARCHIVE_OK && *len == 0)
+ do {
rc = archive_read_data_block(p->a, buffer, len, &offset64);
+ } while (rc == ARCHIVE_OK && *len == 0);
if (rc == ARCHIVE_EOF) {
*len = 0;
