Check that a file belongs to the package before removing it
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Tue, 8 Jun 2010 01:05:01 +0000 (01:05 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Tue, 8 Jun 2010 01:05:01 +0000 (01:05 +0000)
Fixes the test case in Issue #50.

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

libopkg/opkg_remove.c

index a866c04aa0bd3f7f75e1bf2143ab1562064b200a..4920587859b4e579e9720edb23cf21a0133e72f1 100644 (file)
@@ -341,6 +341,11 @@ remove_data_files_and_list(pkg_t *pkg)
      for (iter = str_list_first(installed_files); iter; iter = str_list_next(installed_files, iter)) {
          file_name = (char *)iter->data;
 
+         owner = file_hash_get_file_owner(file_name);
+         if (owner != pkg)
+                 /* File may have been claimed by another package. */
+                 continue;
+
          if (file_is_dir(file_name)) {
               str_list_append(&installed_dirs, file_name);
               continue;