]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Revert "tools: remove empty snap directory"
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 15 Aug 2017 16:14:19 +0000 (18:14 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 15 Aug 2017 16:45:18 +0000 (18:45 +0200)
This reverts commit d51915386e22a19da131a578330ab1115905c326.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_destroy.c

index 8b932dd1789c3c5bc8defbf4807c7b4a74d3a55f..fee4d80498510d9d45ff6bcea0ff75995d7bbe25 100644 (file)
@@ -171,7 +171,7 @@ static bool do_destroy(struct lxc_container *c)
        if (ret < 0 || ret >= MAXPATHLEN)
                return false;
 
-       if (rmdir(path) < 0 && errno != ENOENT) {
+       if (dir_exists(path)) {
                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 (rmdir(path) < 0 && errno != ENOENT)
+       if (dir_exists(path))
                bret = c->destroy_with_snapshots(c);
        else
                bret = do_destroy(c);