opkg_cmd: fix endless loop in whatprovides/whatreplaces
authorJo-Philipp Wich <jo@mein.io>
Mon, 27 Feb 2017 19:19:21 +0000 (20:19 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 27 Feb 2017 19:19:21 +0000 (20:19 +0100)
Fix the loop semantics in opkg_what_provides_replaces_cmd() to properly
advance the package vector pointer.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/opkg_cmd.c

index a972553..d0d2877 100644 (file)
@@ -1136,7 +1136,7 @@ opkg_what_provides_replaces_cmd(enum what_field_type what_field_type, int argc,
                                abpkgs = pkg_get_ptr(pkg, (what_field_type == WHATPROVIDES) ? PKG_PROVIDES : PKG_REPLACES);
 
                                while (abpkgs && *abpkgs) {
-                                       apkg = *abpkgs;
+                                       apkg = *abpkgs++;
 
                                        if (fnmatch(target, apkg->name, conf->nocase))
                                                continue;
@@ -1148,7 +1148,6 @@ opkg_what_provides_replaces_cmd(enum what_field_type what_field_type, int argc,
                                                opkg_msg(NOTICE, "\t%s %s\n", rel_str, apkg->name);
 
                                        opkg_message(NOTICE, "\n");
-                                       abpkgs++;
                                }
                        }
                }