From 9c3a0ce674142f6a1b5e4043cfb44d89d05746ed Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sat, 24 Feb 2018 15:16:40 +0100 Subject: [PATCH] lxccontainer: do_lxcapi_is_defined() Signed-off-by: Christian Brauner --- src/lxc/lxccontainer.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 0262704e4..e4e7002e4 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -349,24 +349,28 @@ int lxc_container_put(struct lxc_container *c) static bool do_lxcapi_is_defined(struct lxc_container *c) { + int statret; struct stat statbuf; bool ret = false; - int statret; if (!c) return false; if (container_mem_lock(c)) return false; + if (!c->configfile) - goto out; + goto on_error; + statret = stat(c->configfile, &statbuf); if (statret != 0) - goto out; + goto on_error; + ret = true; -out: +on_error: container_mem_unlock(c); + return ret; } -- 2.47.3