From: Christian Brauner Date: Sat, 15 Jul 2017 20:50:15 +0000 (+0200) Subject: tools: remove empty snap directory X-Git-Tag: lxc-2.1.0~32^2~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb0760f9d624e42146615019c1e217b6f88a33aa;p=thirdparty%2Flxc.git tools: remove empty snap directory Signed-off-by: Christian Brauner --- diff --git a/src/lxc/tools/lxc_destroy.c b/src/lxc/tools/lxc_destroy.c index fee4d8049..8b932dd17 100644 --- a/src/lxc/tools/lxc_destroy.c +++ b/src/lxc/tools/lxc_destroy.c @@ -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);