]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: fix lxc-create with global config value II
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 25 May 2018 17:35:00 +0000 (19:35 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 10 Dec 2018 07:32:28 +0000 (08:32 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_create.c

index 5aad38052e606fcd32901549197341154a8976e8..915f62984d4aa4dbefe5f997942d433f4031b49a 100644 (file)
@@ -254,24 +254,19 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       if (geteuid()) {
-               if (!my_args.lxcpath[0])
-                       my_args.lxcpath[0] = lxc_get_global_config_item("lxc.lxcpath");
 
-               if (mkdir_p(my_args.lxcpath[0], 0755))
-                       exit(EXIT_FAILURE);
+       if (!my_args.lxcpath[0])
+               my_args.lxcpath[0] = lxc_get_global_config_item("lxc.lxcpath");
+
+       if (mkdir_p(my_args.lxcpath[0], 0755))
+               exit(EXIT_FAILURE);
 
+       if (geteuid())
                if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
-                       fprintf(stderr, "You lack access to %s\n", my_args.lxcpath[0]);
+                       fprintf(stderr, "You lack access to %s\n",
+                               my_args.lxcpath[0]);
                        exit(EXIT_FAILURE);
                }
-               if (strcmp(my_args.bdevtype, "dir") && strcmp(my_args.bdevtype, "_unset") &&
-                               strcmp(my_args.bdevtype, "btrfs")) {
-                       fprintf(stderr, "Unprivileged users cannot create %s containers.\n", my_args.bdevtype);
-                       exit(EXIT_FAILURE);
-               }
-       }
-
 
        c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
        if (!c) {