commit: 153e9ff8bec2ec4cd1e777ee4b24e477a716ee87
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 15 20:54:30 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Oct 15 21:02:19 2015 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=153e9ff8
atom_explode: fix setup of PVR
Tests are included in the next commit.
libq/atom_explode.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libq/atom_explode.c b/libq/atom_explode.c
index 9eb5695..2855246 100644
--- a/libq/atom_explode.c
+++ b/libq/atom_explode.c
@@ -161,7 +161,6 @@ depend_atom *atom_explode(const char *atom)
ret->PN = ret->CATEGORY;
ret->CATEGORY = NULL;
}
- strcpy(ret->PVR, ret->PN);
/* find -r# */
ptr = ret->PN + strlen(ret->PN) - 1;
@@ -170,8 +169,7 @@ depend_atom *atom_explode(const char *atom)
if (ptr[0] == 'r' && ptr[-1] == '-') {
ret->PR_int = atoi(ptr + 1);
ptr[-1] = '\0';
- } else
- strcat(ret->PVR, "-r0");
+ }
break;
}
--ptr;
@@ -236,6 +234,8 @@ depend_atom *atom_explode(const char *atom)
break;
if (has_pv) {
ret->PV = ret->P + (ptr - ret->PN) + 1;
+ ptr = stpcpy(ret->PVR, ret->PV);
+ sprintf(ptr, "-r%i", ret->PR_int);
} else {
/* atom has no version */
ret->PV = ret->PVR = NULL;