return 0;
}
-static inline void lxc_proc_close_ns_fd(struct attach_context *ctx)
+static inline void close_nsfds(struct attach_context *ctx)
{
for (int i = 0; i < LXC_NS_MAX; i++)
close_prot_errno_disarm(ctx->ns_fd[i]);
ctx->container = NULL;
}
- lxc_proc_close_ns_fd(ctx);
+ close_nsfds(ctx);
free(ctx);
}
ret = get_attach_context(ctx, container);
if (ret) {
ERROR("Failed to get attach context");
- lxc_container_put(container);
+ put_attach_context(ctx);
return -1;
}
}
/* close namespace file descriptors */
- lxc_proc_close_ns_fd(ctx);
+ close_nsfds(ctx);
/* Attach succeeded, try to cwd. */
if (options->initial_cwd)
/* close unneeded file descriptors */
close(ipc_sockets[1]);
free_disarm(cwd);
- lxc_proc_close_ns_fd(ctx);
+ close_nsfds(ctx);
if (options->attach_flags & LXC_ATTACH_TERMINAL)
lxc_attach_terminal_close_pts(&terminal);