Pass the correct file_name to pkg_get_conffile().
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 16 Nov 2009 02:36:38 +0000 (02:36 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 16 Nov 2009 02:36:38 +0000 (02:36 +0000)
This should prevent modified conf files from being deleted for offline roots
and non root dests.

git-svn-id: http://opkg.googlecode.com/svn/trunk@317 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/opkg_remove.c

index 12d5d0c4f9a39693eeeb6105d161b36afc08ddab..eb037146a4715b6da3a966d4377e664c2cb69abd 100644 (file)
@@ -334,10 +334,14 @@ int remove_data_files_and_list(opkg_conf_t *conf, pkg_t *pkg)
      conffile_t *conffile;
      int removed_a_dir;
      pkg_t *owner;
+     int rootdirlen;
 
      str_list_init(&installed_dirs);
      installed_files = pkg_get_installed_files(pkg);
 
+     /* don't include trailing slash */
+     rootdirlen = strlen(pkg->dest->root_dir) -1;
+
      for (iter = str_list_first(installed_files); iter; iter = str_list_next(installed_files, iter)) {
          file_name = (char *)iter->data;
 
@@ -346,7 +350,7 @@ int remove_data_files_and_list(opkg_conf_t *conf, pkg_t *pkg)
               continue;
          }
 
-         conffile = pkg_get_conffile(pkg, file_name);
+         conffile = pkg_get_conffile(pkg, file_name+rootdirlen);
          if (conffile) {
               /* XXX: QUESTION: Is this right? I figure we only need to
                  save the conffile if it has been modified. Is that what