+ crc_header = crc32(buffer, header_len - (count ? CRC_LEN : TOKEN_LEN), crc_header);
+
+ // read payload and calculate CRC32
+ lseek(fd, offset, SEEK_SET);
+ if ( (payload = heap_and_reap(NULL, len, 1)) != NULL) {
+ if ( (qty = read(fd, payload, len)) < len) {
+ fprintf(stderr, "skipping CRC calculation: only able to read %ld of %ld bytes\n", qty, len);
+ } else {
+ crc_payload = crc32(payload, len, crc_payload);
+
+ heap_and_reap(payload, 0, 0);
+ }
+ } else {
+ close(fd);
+ pr_error_exit(0, "unable to allocate memory (%ld bytes)\n", len);
+ }