[lxc-devel] [PATCH] lxc_rmdir_onedev: don't fail if path doesn't exist

Serge Hallyn serge.hallyn at ubuntu.com
Mon Sep 21 17:01:10 UTC 2015


We're asked to delete it, don't fail if it doesn't exist.

This stops lxc-destroy from failing when the container isn't fully
built.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index 7ced314..0b83960 100644
--- a/src/lxc/utils.c
+++ b/src/lxc/utils.c
@@ -197,6 +197,8 @@ extern int lxc_rmdir_onedev(char *path, const char *exclude)
 	}
 
 	if (lstat(path, &mystat) < 0) {
+		if (errno == ENOENT)
+			return 0;
 		ERROR("%s: failed to stat %s", __func__, path);
 		return -1;
 	}
-- 
2.5.0



More information about the lxc-devel mailing list