From 3d39889a7b2689be560a92b4d0bf1e086e6605b2 Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Mon, 09 Mar 2009 00:39:22 -0400 Subject: because of the file_hash_set_file_owner may break the file list of pkgs it should be iterated more carefully. Dealing with http://code.google.com/p/opkg/issues/detail?id=9 git-svn-id: http://opkg.googlecode.com/svn/trunk@204 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'libopkg/pkg.c') diff --git a/libopkg/pkg.c b/libopkg/pkg.c index 98a929c..6e0f396 100644 --- a/libopkg/pkg.c +++ b/libopkg/pkg.c @@ -1761,12 +1761,14 @@ int pkg_info_preinstall_check(opkg_conf_t *conf) for (i = 0; i < installed_pkgs->len; i++) { pkg_t *pkg = installed_pkgs->pkgs[i]; str_list_t *installed_files = pkg_get_installed_files(pkg); /* this causes installed_files to be cached */ - str_list_elt_t *iter; + str_list_elt_t *iter, *niter; if (installed_files == NULL) { opkg_message(conf, OPKG_ERROR, "No installed files for pkg %s\n", pkg->name); break; } - for (iter = str_list_first(installed_files); iter; iter = str_list_next(installed_files, iter)) { + for (iter = str_list_first(installed_files), niter = str_list_next(installed_files, iter); + iter; + iter = niter, niter = str_list_next(installed_files, iter)) { char *installed_file = (char *) iter->data; // opkg_message(conf, OPKG_DEBUG2, "pkg %s: file=%s\n", pkg->name, installed_file); file_hash_set_file_owner(conf, installed_file, pkg); -- cgit v0.9.1