Move RPMSIGTAG_SIZE vs PMSIGTAG_LONGSIZE detection to rpmGenDigest()
Fixes problem with rpmSign() only using RPMSIGTAG_SIZE Fixes rh#1012595 for now as we are only moving to PMSIGTAG_LONGSIZE when needed
This commit is contained in:
parent
09fb3830b6
commit
116a6f7105
|
@ -257,7 +257,6 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp,
|
|||
int xx;
|
||||
rpmRC rc = RPMRC_OK;
|
||||
struct rpmtd_s td;
|
||||
rpmTagVal sizetag;
|
||||
rpmTagVal payloadtag;
|
||||
|
||||
if (pkgidp)
|
||||
|
@ -377,13 +376,11 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp,
|
|||
* such a package.
|
||||
*/
|
||||
if (pkg->cpioArchiveSize < UINT32_MAX) {
|
||||
sizetag = RPMSIGTAG_SIZE;
|
||||
payloadtag = RPMSIGTAG_PAYLOADSIZE;
|
||||
} else {
|
||||
sizetag = RPMSIGTAG_LONGSIZE;
|
||||
payloadtag = RPMSIGTAG_LONGARCHIVESIZE;
|
||||
}
|
||||
(void) rpmGenDigest(sig, sigtarget, sizetag);
|
||||
(void) rpmGenDigest(sig, sigtarget, RPMSIGTAG_SIZE);
|
||||
(void) rpmGenDigest(sig, sigtarget, RPMSIGTAG_MD5);
|
||||
|
||||
if (SHA1) {
|
||||
|
|
|
@ -347,24 +347,24 @@ int rpmGenDigest(Header sigh, const char * file, rpmTagVal sigTag)
|
|||
int ret = -1; /* assume failure. */
|
||||
|
||||
switch (sigTag) {
|
||||
case RPMSIGTAG_SIZE: {
|
||||
rpm_off_t size;
|
||||
case RPMSIGTAG_SIZE:
|
||||
case RPMSIGTAG_LONGSIZE:
|
||||
if (stat(file, &st) != 0)
|
||||
break;
|
||||
size = st.st_size;
|
||||
if (!sighdrPut(sigh, sigTag, RPM_INT32_TYPE, &size, 1))
|
||||
break;
|
||||
ret = 0;
|
||||
} break;
|
||||
case RPMSIGTAG_LONGSIZE: {
|
||||
rpm_loff_t size;
|
||||
if (stat(file, &st) != 0)
|
||||
break;
|
||||
size = st.st_size;
|
||||
if (!sighdrPut(sigh, sigTag, RPM_INT64_TYPE, &size, 1))
|
||||
break;
|
||||
ret = 0;
|
||||
} break;
|
||||
if (st.st_size>UINT32_MAX || sigTag==RPMSIGTAG_LONGSIZE) {
|
||||
rpm_loff_t size;
|
||||
size = st.st_size;
|
||||
if (!sighdrPut(sigh, RPMSIGTAG_LONGSIZE, RPM_INT64_TYPE, &size, 1))
|
||||
break;
|
||||
ret = 0;
|
||||
} else {
|
||||
rpm_off_t size;
|
||||
size = st.st_size;
|
||||
if (!sighdrPut(sigh, RPMSIGTAG_SIZE, RPM_INT32_TYPE, &size, 1))
|
||||
break;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
case RPMSIGTAG_MD5:
|
||||
pktlen = 16;
|
||||
pkt = xcalloc(pktlen, sizeof(*pkt));
|
||||
|
|
Loading…
Reference in New Issue