check_data_file_clashes_change: remove duplicated offline root in paths
authorAlejandro del Castillo <alejandro.delcastillo@ni.com>
Wed, 23 Mar 2016 23:14:50 +0000 (18:14 -0500)
committerJo-Philipp Wich <jo@mein.io>
Wed, 15 Mar 2017 02:18:34 +0000 (03:18 +0100)
The function check_data_file_clashes_change update the ownership of
files that belong to a package being replaced. It calls
pkg_get_installed_files then adds an offline root if
opkg_conf->offline_root to each path. However, pkg_get_installed_files
already returns paths with the offline root (if present).

This fixes issue 156.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
libopkg/opkg_install.c

index ccf6f455377674a922768270a049d2f162fdf6fc..e6f8a1b6276ede518a5c59b2f9347f1de8e5dd7a 100644 (file)
@@ -884,8 +884,6 @@ static int check_data_file_clashes_change(pkg_t * pkg, pkg_t * old_pkg)
        str_list_t *files_list;
        str_list_elt_t *iter, *niter;
 
-       char *root_filename = NULL;
-
        files_list = pkg_get_installed_files(pkg);
        if (files_list == NULL)
                return -1;
@@ -894,12 +892,7 @@ static int check_data_file_clashes_change(pkg_t * pkg, pkg_t * old_pkg)
             str_list_next(files_list, iter); iter;
             iter = niter, niter = str_list_next(files_list, niter)) {
                char *filename = (char *)iter->data;
-               if (root_filename) {
-                       free(root_filename);
-                       root_filename = NULL;
-               }
-               root_filename = root_filename_alloc(filename);
-               if (file_exists(root_filename) && (!file_is_dir(root_filename))) {
+               if (file_exists(filename) && (!file_is_dir(filename))) {
                        pkg_t *owner;
 
                        owner = file_hash_get_file_owner(filename);
@@ -926,10 +919,6 @@ static int check_data_file_clashes_change(pkg_t * pkg, pkg_t * old_pkg)
 
                }
        }
-       if (root_filename) {
-               free(root_filename);
-               root_filename = NULL;
-       }
        pkg_free_installed_files(pkg);
 
        return 0;