aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2016-10-13 13:05:32 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2016-10-13 13:09:27 +0200
commit50b2b1b2be0ecb0bcdce376bb586f7f9db5b6592 (patch)
treee872c74c3abae3d38a8cf3d8f3ce7de6b7b560df /URPM.xs
parent5aa38aea4d7f9c1ff88c3c1a9c9ccf297d5caac0 (diff)
downloadperl-URPM-50b2b1b2be0ecb0bcdce376bb586f7f9db5b6592.tar
perl-URPM-50b2b1b2be0ecb0bcdce376bb586f7f9db5b6592.tar.gz
perl-URPM-50b2b1b2be0ecb0bcdce376bb586f7f9db5b6592.tar.bz2
perl-URPM-50b2b1b2be0ecb0bcdce376bb586f7f9db5b6592.tar.xz
perl-URPM-50b2b1b2be0ecb0bcdce376bb586f7f9db5b6592.zip
fix reporting size on big packages (mga#19571)
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs10
1 files changed, 4 insertions, 6 deletions
diff --git a/URPM.xs b/URPM.xs
index 41a6b8c..bd0c6f8 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -201,13 +201,12 @@ get_arch(const Header header) {
return headerIsEntry(header, RPMTAG_SOURCERPM) ? get_name(header, RPMTAG_ARCH) : "src";
}
-static int
+static uint64_t
get_int(const Header header, rpmTag tag) {
struct rpmtd_s val;
- headerGet(header, tag, &val, HEADERGET_DEFAULT);
- uint32_t *ep = rpmtdGetUint32(&val);
- return ep ? *ep : 0;
+ headerGet(header, tag, &val, HEADERGET_ALLOC);
+ return rpmtdGetNumber(&val);
}
static size_t
@@ -755,8 +754,7 @@ pack_header(const URPM__Package pkg) {
const char *p = buff;
const char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR);
const char *arch = get_arch(pkg->h);
-
- p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%d@%d@%s", nvr, arch,
+ p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%lu@%lu@%s", nvr, arch,
get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE),
get_name(pkg->h, RPMTAG_GROUP));
pkg->info = memcpy(malloc(p-buff), buff, p-buff);