Iterate the whole depends array, in the unlikely event that pre_depends_count!=0
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Fri, 20 Nov 2009 03:35:47 +0000 (03:35 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Fri, 20 Nov 2009 03:35:47 +0000 (03:35 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@343 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/opkg_install.c
libopkg/opkg_remove.c

index e28f6b49be240850b9d36c5356d19280dba6d960..f9245ca7985278ceef431b0bf725352390290d5d 100644 (file)
@@ -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;
index 3e90836dbd49b0da4c55d944eef26ebbc4d78870..aba35125aed822957de333c3af4e759a8ee15622 100644 (file)
@@ -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;