]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxccontainer: use userns_exec_full()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 9 Sep 2017 09:21:16 +0000 (11:21 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 24 Sep 2017 04:36:16 +0000 (00:36 -0400)
Closes #1800.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/lxccontainer.c

index 134485c4a15e9ef1f14ce795b47b660a83cea30c..0f65621ba13c9d0bb791b8e1fdfe8d6c0031fe59 100644 (file)
@@ -2496,12 +2496,17 @@ static bool has_snapshots(struct lxc_container *c)
 }
 
 static bool do_destroy_container(struct lxc_conf *conf) {
+       int ret;
+
        if (am_unpriv()) {
-               if (userns_exec_1(conf, storage_destroy_wrapper, conf,
-                                 "storage_destroy_wrapper") < 0)
+               ret = userns_exec_full(conf, storage_destroy_wrapper, conf,
+                                      "storage_destroy_wrapper");
+               if (ret < 0)
                        return false;
+
                return true;
        }
+
        return storage_destroy(conf);
 }
 
@@ -2580,8 +2585,8 @@ static bool container_destroy(struct lxc_container *c)
        char *path = alloca(strlen(p1) + strlen(c->name) + 2);
        sprintf(path, "%s/%s", p1, c->name);
        if (am_unpriv())
-               ret = userns_exec_1(conf, lxc_rmdir_onedev_wrapper, path,
-                                   "lxc_rmdir_onedev_wrapper");
+               ret = userns_exec_full(conf, lxc_rmdir_onedev_wrapper, path,
+                                      "lxc_rmdir_onedev_wrapper");
        else
                ret = lxc_rmdir_onedev(path, "snaps");
        if (ret < 0) {
@@ -3393,8 +3398,8 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
        data.flags = flags;
        data.hookargs = hookargs;
        if (am_unpriv())
-               ret = userns_exec_1(c->lxc_conf, clone_update_rootfs_wrapper,
-                                   &data, "clone_update_rootfs_wrapper");
+               ret = userns_exec_full(c->lxc_conf, clone_update_rootfs_wrapper,
+                                      &data, "clone_update_rootfs_wrapper");
        else
                ret = clone_update_rootfs(&data);
        if (ret < 0)