From: Christian Brauner Date: Sun, 18 Feb 2018 22:41:21 +0000 (+0100) Subject: start: print_top_failing_dir() X-Git-Tag: lxc-2.0.10~262 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e836f50a34bcedf705e08e2b48d1355b7f01af43;p=thirdparty%2Flxc.git start: print_top_failing_dir() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/start.c b/src/lxc/start.c index 4cb19d4cd..b84727366 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -92,23 +92,30 @@ static void lxc_destroy_container_on_signal(struct lxc_handler *handler, static void print_top_failing_dir(const char *path) { - size_t len = strlen(path); - char *copy = alloca(len + 1), *p, *e, saved; - strcpy(copy, path); + int ret; + size_t len; + char *copy, *e, *p, saved; + len = strlen(path); + copy = alloca(len + 1); + strcpy(copy, path); p = copy; e = copy + len; while (p < e) { while (p < e && *p == '/') p++; + while (p < e && *p != '/') p++; + saved = *p; *p = '\0'; - if (access(copy, X_OK)) { + + ret = access(copy, X_OK); + if (ret != 0) { SYSERROR("Could not access %s. Please grant it x " "access, or add an ACL for the container " - "root.", copy); + "root", copy); return; } *p = saved;