return zalloc(sizeof(struct attach_context));
}
+static signed long get_personality(const char *name, const char *lxcpath)
+{
+ __do_free char *p = NULL;
+
+ p = lxc_cmd_get_config_item(name, "lxc.arch", lxcpath);
+ if (!p)
+ return -1;
+
+ return lxc_config_parse_arch(p);
+}
+
static int get_attach_context(struct attach_context *ctx,
struct lxc_container *container)
{
for (int i = 0; i < LXC_NS_MAX; i++)
ctx->ns_fd[i] = -EBADF;
+ ctx->personality = get_personality(container->name, container->config_path);
+ if (ctx->personality < 0)
+ return log_error_errno(-ENOENT, ENOENT, "Failed to get personality of the container");
+
return 0;
}
return c->set_config_item(c, "lxc.no_new_privs", val);
}
-static signed long get_personality(const char *name, const char *lxcpath)
-{
- __do_free char *p = NULL;
-
- p = lxc_cmd_get_config_item(name, "lxc.arch", lxcpath);
- if (!p)
- return -1;
-
- return lxc_config_parse_arch(p);
-}
-
struct attach_clone_payload {
int ipc_socket;
int terminal_pts_fd;
int i, ret, status;
char *name, *lxcpath, *new_cwd;
int ipc_sockets[2];
- signed long personality;
pid_t attached_pid, pid, to_cleanup_pid;
struct attach_context *ctx;
struct lxc_terminal terminal;
return -1;
}
- personality = get_personality(name, lxcpath);
- if (ctx->personality < 0) {
- ERROR("Failed to get personality of the container");
- put_attach_context(ctx);
- return -1;
- }
- ctx->personality = personality;
-
if (!ctx->container->lxc_conf) {
ctx->container->lxc_conf = lxc_conf_init();
if (!ctx->container->lxc_conf) {