summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-19 22:35:47 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-19 22:35:47 (EST)
commitda516f8c8ef6bc6275216eb256afa5ab5b94b688 (patch)
tree3d7b1023f60d68f062073dbb592a334e3b608aa7
parent7266416702d6d83cd1a2bc3a7b3e579d711c83df (diff)
Iterate the whole depends array, in the unlikely event that pre_depends_count!=0
git-svn-id: http://opkg.googlecode.com/svn/trunk@343 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/opkg_install.c13
-rw-r--r--libopkg/opkg_remove.c7
2 files changed, 17 insertions, 3 deletions
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index e28f6b4..f9245ca 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -586,7 +586,16 @@ pkg_remove_orphan_dependent(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg)
struct compound_depend *cd0, *cd1;
abstract_pkg_t **dependents;
- for (i=0; i<old_pkg->depends_count; i++) {
+ int count0 = old_pkg->pre_depends_count +
+ old_pkg->depends_count +
+ old_pkg->recommends_count +
+ old_pkg->suggests_count;
+ int count1 = pkg->pre_depends_count +
+ pkg->depends_count +
+ pkg->recommends_count +
+ pkg->suggests_count;
+
+ for (i=0; i<count0; i++) {
cd0 = &old_pkg->depends[i];
if (cd0->type != DEPEND)
continue;
@@ -594,7 +603,7 @@ pkg_remove_orphan_dependent(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg)
found = 0;
- for (k=0; k<pkg->depends_count; k++) {
+ for (k=0; k<count1; k++) {
cd1 = &pkg->depends[i];
if (cd1->type != DEPEND)
continue;
diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
index 3e90836..aba3512 100644
--- a/libopkg/opkg_remove.c
+++ b/libopkg/opkg_remove.c
@@ -176,7 +176,12 @@ remove_autoinstalled(opkg_conf_t *conf, pkg_t *pkg)
struct compound_depend *cdep;
abstract_pkg_t **dependents;
- for (i=0; i<pkg->depends_count; i++) {
+ int count = pkg->pre_depends_count +
+ pkg->depends_count +
+ pkg->recommends_count +
+ pkg->suggests_count;
+
+ for (i=0; i<count; i++) {
cdep = &pkg->depends[i];
if (cdep->type != DEPEND)
continue;