From: Michael Tremer Date: Sun, 21 Mar 2021 13:16:42 +0000 (+0000) Subject: Always create temporary environments in tmpfs X-Git-Tag: 0.9.28~1285^2~499 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcc7d3d66d0c08f12e703c104197b7982e602d81;p=pakfire.git Always create temporary environments in tmpfs Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index 9f15401a0..1fc0f31e3 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -138,9 +138,13 @@ ERROR: static void pakfire_free(Pakfire pakfire) { DEBUG(pakfire, "Releasing Pakfire at %p\n", pakfire); - if (pakfire->destroy_on_free) { + if (pakfire->destroy_on_free && *pakfire->path) { DEBUG(pakfire, "Destroying %s\n", pakfire->path); + // Umount the temporary file system + umount(pakfire->path); + + // Destroy the temporary directory pakfire_rmtree(pakfire->path, 0); } @@ -214,6 +218,11 @@ PAKFIRE_EXPORT int pakfire_create(Pakfire* pakfire, const char* path, const char // Destroy everything when done p->destroy_on_free = 1; + + // Mount tmpfs + r = mount("pakfire_root", path, "tmpfs", 0, NULL); + if (r) + goto ERROR; } // Set path