From 1d0263bb40e3c099501fc1f2431907636230e7f2 Mon Sep 17 00:00:00 2001 From: Alejandro del Castillo Date: Wed, 23 Mar 2016 18:14:50 -0500 Subject: [PATCH] check_data_file_clashes_change: remove duplicated offline root in paths 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 --- libopkg/opkg_install.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index ccf6f45..e6f8a1b 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -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; -- 2.25.1