FD_t fdi, fdo;
Header h;
char * rpmio_flags = NULL;
- rpmRC rc;
+ int rc;
+ off_t payload_size;
FD_t gzdi;
setprogname(argv[0]); /* Retrofit glibc __progname */
break;
}
- /* Retrieve type of payload compression. */
+ /* Retrieve payload size and compression type. */
{ const char *compr = headerGetString(h, RPMTAG_PAYLOADCOMPRESSOR);
rpmio_flags = rstrscat(NULL, "r.", compr ? compr : "gzip", NULL);
+ payload_size = headerGetNumber(h, RPMTAG_LONGARCHIVESIZE);
}
gzdi = Fdopen(fdi, rpmio_flags); /* XXX gzdi == fdi */
exit(EXIT_FAILURE);
}
- rc = ufdCopy(gzdi, fdo);
- rc = (rc <= 0) ? EXIT_FAILURE : EXIT_SUCCESS;
+ rc = (ufdCopy(gzdi, fdo) == payload_size) ? EXIT_SUCCESS : EXIT_FAILURE;
+
Fclose(fdo);
Fclose(gzdi); /* XXX gzdi == fdi */