diff options
author | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-06-28 17:20:36 +0000 |
---|---|---|
committer | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-06-28 17:20:36 +0000 |
commit | 7f5333d06bc6d93684efc6a7e2011fa6acd5a1a8 (patch) | |
tree | c75c7bffe06bada1e096bf07d31ff3006eafd85d | |
parent | 3cdd4b43acca5d37b009031ed8f752958c97d89a (diff) | |
download | perl-URPM-7f5333d06bc6d93684efc6a7e2011fa6acd5a1a8.tar perl-URPM-7f5333d06bc6d93684efc6a7e2011fa6acd5a1a8.tar.gz perl-URPM-7f5333d06bc6d93684efc6a7e2011fa6acd5a1a8.tar.bz2 perl-URPM-7f5333d06bc6d93684efc6a7e2011fa6acd5a1a8.tar.xz perl-URPM-7f5333d06bc6d93684efc6a7e2011fa6acd5a1a8.zip |
fix mixup so that we modify the header with the new values, not the old
-rw-r--r-- | URPM.xs | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -277,7 +277,7 @@ strip_distepoch(Header header, int_32 tag) { static void pretend_distepoch(Header header, int_32 names_tag, int_32 flags_tag, int_32 versions_tag) { char **name = NULL, **name2 = NULL; - int_32 *flag, *flag2; + int_32 *flag = NULL, *flag2 = NULL; int_32 type, type2; int_32 count, count2; int_32 ix; @@ -298,11 +298,11 @@ pretend_distepoch(Header header, int_32 names_tag, int_32 flags_tag, int_32 vers flag2 = malloc(count * sizeof(flag)); memcpy(flag2, flag, sizeof(flag)*count); version2 = malloc(count * sizeof(*version)); - memcpy(version2, version, sizeof(*version)*count); + memcpy(version2, version, count * sizeof(*version)); } else { name2 = realloc(name2, sizeof(*name) * ++count); flag2 = realloc(flag2, sizeof(flag) * count); - version2 = realloc(version2, sizeof(*version) * count); + version2 = realloc(version2, count * sizeof(*version)); } name2[count-1] = name[ix]; flag2[count-1] = (flag[ix] | RPMSENSE_LESS) & ~RPMSENSE_EQUAL; @@ -313,9 +313,9 @@ pretend_distepoch(Header header, int_32 names_tag, int_32 flags_tag, int_32 vers } } if(name) { - headerModifyEntry(header, names_tag, RPM_STRING_ARRAY_TYPE, name, count); - headerModifyEntry(header, flags_tag, RPM_INT32_TYPE, flag, count); - headerModifyEntry(header, versions_tag, RPM_STRING_ARRAY_TYPE, version, count); + headerModifyEntry(header, names_tag, RPM_STRING_ARRAY_TYPE, name2, count); + headerModifyEntry(header, flags_tag, RPM_INT32_TYPE, flag2, count); + headerModifyEntry(header, versions_tag, RPM_STRING_ARRAY_TYPE, version2, count); } } |