]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: print_top_failing_dir()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 18 Feb 2018 22:41:21 +0000 (23:41 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 21 Feb 2018 16:59:41 +0000 (17:59 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index 4cb19d4cd5368c3c96bc3fe0c6f289a20f2f61b8..b8472736632ee8989fdf6a7b891296d098920055 100644 (file)
@@ -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;