]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: remove empty snap directory
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 15 Jul 2017 20:50:15 +0000 (22:50 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 31 Jul 2017 21:34:14 +0000 (23:34 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_destroy.c

index fee4d80498510d9d45ff6bcea0ff75995d7bbe25..8b932dd1789c3c5bc8defbf4807c7b4a74d3a55f 100644 (file)
@@ -171,7 +171,7 @@ static bool do_destroy(struct lxc_container *c)
        if (ret < 0 || ret >= MAXPATHLEN)
                return false;
 
-       if (dir_exists(path)) {
+       if (rmdir(path) < 0 && errno != ENOENT) {
                if (!quiet)
                        fprintf(stdout, "Destroying %s failed: %s has snapshots.\n", c->name, c->name);
                return false;
@@ -271,7 +271,7 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
        if (ret < 0 || ret >= MAXPATHLEN)
                return false;
 
-       if (dir_exists(path))
+       if (rmdir(path) < 0 && errno != ENOENT)
                bret = c->destroy_with_snapshots(c);
        else
                bret = do_destroy(c);