aboutsummaryrefslogtreecommitdiffstats
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-14 17:16:52 +0200
commitba454a00703696b8fb2e01a6c3f9fcd0dd237fdb (patch)
treebe1c9e18b0c8473afd48da1098685a0d74f13b3a
parent0614f7884b17c20e6e502dc2a32289c9e7682dfc (diff)
downloadperl-URPM-ba454a00703696b8fb2e01a6c3f9fcd0dd237fdb.tar
perl-URPM-ba454a00703696b8fb2e01a6c3f9fcd0dd237fdb.tar.gz
perl-URPM-ba454a00703696b8fb2e01a6c3f9fcd0dd237fdb.tar.bz2
perl-URPM-ba454a00703696b8fb2e01a6c3f9fcd0dd237fdb.tar.xz
perl-URPM-ba454a00703696b8fb2e01a6c3f9fcd0dd237fdb.zip
fix reporting size on big packages (mga#19571)
-rw-r--r--NEWS2
-rw-r--r--URPM.xs10
2 files changed, 6 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index a75c538..2c5ea4d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- fix reporting size on big packages (mga#19571)
+
Version 5.06 - 12 April 2015
- fix upgrade when package's in several media (mga#15350)
diff --git a/URPM.xs b/URPM.xs
index 40e3c46..f524215 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -200,13 +200,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
@@ -754,8 +753,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);