From 89ac8aa9c45486aa4f4b9599bb094f1d54ff1b66 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Wed, 24 Oct 2007 22:58:34 +0200 Subject: [PATCH] _alpm_depmiss_isin fix The old code used memcmp, which is not good for comparing strings: "pkgname"'\0''\0' should be equal to "pkgname"'\0''a' for example. The new code uses strcmp. Signed-off-by: Dan McGee --- lib/libalpm/deps.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index b7e49be2..69c675cd 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -98,8 +98,11 @@ int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack) for(i = haystack; i; i = i->next) { pmdepmissing_t *miss = i->data; - if(!memcmp(needle, miss, sizeof(pmdepmissing_t)) - && !memcmp(&needle->depend, &miss->depend, sizeof(pmdepend_t))) { + if(needle->type == miss->type && + !strcmp(needle->target, miss->target) && + needle->depend.mod == miss->depend.mod && + !strcmp(needle->depend.name, miss->depend.name) && + !strcmp(needle->depend.version, miss->depend.version)) { return(1); } }