]> sourceware.org Git - libabigail.git/commitdiff
Make abipkgdiff erase the *parent* directory of temporary files
authorDodji Seketeli <dodji@redhat.com>
Fri, 24 Jul 2015 12:09:55 +0000 (14:09 +0200)
committerDodji Seketeli <dodji@redhat.com>
Fri, 24 Jul 2015 12:09:55 +0000 (14:09 +0200)
abipkgdiff was erasing the temporary files created by it wasn't
erasing the parent directory containing them.  Fixed thus.

* tools/abipkgdiff.cc
(erase_created_temporary_directories_parent): New static function.
(compare): After comparison, erase the temporary parent directory
as well.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
tools/abipkgdiff.cc

index 7a84a11f00a0e29ffc003d1fbf56ede48b1728ab..96a8f5fb54480f59eed71cdd6a05182c8baf22c7 100644 (file)
@@ -425,6 +425,23 @@ erase_created_temporary_directories(const package& first_package,
   second_package.erase_extraction_directories();
 }
 
+/// Erase the root of all the temporary directories created by the
+/// current thread.
+static void
+erase_created_temporary_directories_parent()
+{
+  if (verbose)
+    cerr << "Erasing temporary extraction parent directory "
+        << package::extracted_packages_parent_dir()
+        << " ...";
+
+  string cmd = "rm -rf " + package::extracted_packages_parent_dir();
+  system(cmd.c_str());
+
+  if (verbose)
+    cerr << "DONE\n";
+}
+
 /// Extract the content of a package.
 ///
 /// @param package the package we are looking at.
@@ -821,7 +838,10 @@ compare(package&   first_package,
     }
 
   if (!opts.keep_tmp_files)
-    erase_created_temporary_directories(first_package, second_package);
+    {
+      erase_created_temporary_directories(first_package, second_package);
+      erase_created_temporary_directories_parent();
+    }
 
   return status;
 }
This page took 0.090405 seconds and 5 git commands to generate.