[libvirt] [sandbox] Cleanup the disks.cfg file

Cédric Bosdonnat cbosdonnat at suse.com
Wed Jul 1 08:20:02 UTC 2015


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




More information about the libvir-list mailing list