[sandbox] Cleanup the disks.cfg file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The newly introduced disks.cfg file is still remaining in the
configuration folder after the sandbox is stopped. Let's remove it like
the other things there.
---
 libvirt-sandbox/libvirt-sandbox-builder.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libvirt-sandbox/libvirt-sandbox-builder.c b/libvirt-sandbox/libvirt-sandbox-builder.c
index e615606..ea7d064 100644
--- a/libvirt-sandbox/libvirt-sandbox-builder.c
+++ b/libvirt-sandbox/libvirt-sandbox-builder.c
@@ -22,6 +22,7 @@
 
 #include <config.h>
 #include <string.h>
+#include <errno.h>
 
 #include "libvirt-sandbox/libvirt-sandbox.h"
 #include "libvirt-sandbox/libvirt-sandbox-builder-private.h"
@@ -717,10 +718,15 @@ gboolean gvir_sandbox_builder_clean_post_stop(GVirSandboxBuilder *builder,
     GFileEnumerator *enumerator = NULL;
     GFileInfo *info = NULL;
     GFile *child = NULL;
+    gchar *dskfile = g_build_filename(statedir, "config", "disks.cfg", NULL);
     gboolean ret = TRUE;
 
     ret = klass->clean_post_stop(builder, config, statedir, error);
 
+    if (unlink(dskfile) < 0 &&
+        errno != ENOENT)
+        ret = FALSE;
+
     if (!(enumerator = g_file_enumerate_children(libsFile, "*", G_FILE_QUERY_INFO_NONE,
                                                  NULL, error)) &&
         (*error)->code != G_IO_ERROR_NOT_FOUND) {
-- 
2.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]