attach: use correct lxc_namespace_t type

parent d07d0091
...@@ -194,7 +194,7 @@ static struct attach_context *alloc_attach_context(void) ...@@ -194,7 +194,7 @@ static struct attach_context *alloc_attach_context(void)
ctx->target_host_uid = LXC_INVALID_UID; ctx->target_host_uid = LXC_INVALID_UID;
ctx->target_host_gid = LXC_INVALID_GID; ctx->target_host_gid = LXC_INVALID_GID;
for (int i = 0; i < LXC_NS_MAX; i++) for (lxc_namespace_t i = 0; i < LXC_NS_MAX; i++)
ctx->ns_fd[i] = -EBADF; ctx->ns_fd[i] = -EBADF;
return ctx; return ctx;
...@@ -438,7 +438,7 @@ static int get_attach_context(struct attach_context *ctx, ...@@ -438,7 +438,7 @@ static int get_attach_context(struct attach_context *ctx,
if (options->namespaces == -1) if (options->namespaces == -1)
return log_error_errno(-EINVAL, EINVAL, "Failed to automatically determine the namespaces which the container uses"); return log_error_errno(-EINVAL, EINVAL, "Failed to automatically determine the namespaces which the container uses");
for (int i = 0; i < LXC_NS_MAX; i++) { for (lxc_namespace_t i = 0; i < LXC_NS_MAX; i++) {
if (ns_info[i].clone_flag & CLONE_NEWCGROUP) if (ns_info[i].clone_flag & CLONE_NEWCGROUP)
if (!(options->attach_flags & LXC_ATTACH_MOVE_TO_CGROUP) || if (!(options->attach_flags & LXC_ATTACH_MOVE_TO_CGROUP) ||
!cgns_supported()) !cgns_supported())
...@@ -533,7 +533,7 @@ static int same_ns(int dfd_pid1, int dfd_pid2, const char *ns_path) ...@@ -533,7 +533,7 @@ static int same_ns(int dfd_pid1, int dfd_pid2, const char *ns_path)
static int __prepare_namespaces_pidfd(struct attach_context *ctx) static int __prepare_namespaces_pidfd(struct attach_context *ctx)
{ {
for (int i = 0; i < LXC_NS_MAX; i++) { for (lxc_namespace_t i = 0; i < LXC_NS_MAX; i++) {
int ret; int ret;
ret = same_nsfd(ctx->dfd_self_pid, ret = same_nsfd(ctx->dfd_self_pid,
...@@ -561,8 +561,8 @@ static int __prepare_namespaces_pidfd(struct attach_context *ctx) ...@@ -561,8 +561,8 @@ static int __prepare_namespaces_pidfd(struct attach_context *ctx)
static int __prepare_namespaces_nsfd(struct attach_context *ctx, static int __prepare_namespaces_nsfd(struct attach_context *ctx,
lxc_attach_options_t *options) lxc_attach_options_t *options)
{ {
for (int i = 0; i < LXC_NS_MAX; i++) { for (lxc_namespace_t i = 0; i < LXC_NS_MAX; i++) {
int j; lxc_namespace_t j;
if (options->namespaces & ns_info[i].clone_flag) if (options->namespaces & ns_info[i].clone_flag)
ctx->ns_fd[i] = open_at(ctx->dfd_init_pid, ctx->ns_fd[i] = open_at(ctx->dfd_init_pid,
...@@ -644,7 +644,7 @@ static int __attach_namespaces_nsfd(struct attach_context *ctx, ...@@ -644,7 +644,7 @@ static int __attach_namespaces_nsfd(struct attach_context *ctx,
{ {
int fret = 0; int fret = 0;
for (int i = 0; i < LXC_NS_MAX; i++) { for (lxc_namespace_t i = 0; i < LXC_NS_MAX; i++) {
int ret; int ret;
if (ctx->ns_fd[i] < 0) if (ctx->ns_fd[i] < 0)
...@@ -672,7 +672,7 @@ static int attach_namespaces(struct attach_context *ctx, ...@@ -672,7 +672,7 @@ static int attach_namespaces(struct attach_context *ctx,
lxc_attach_options_t *options) lxc_attach_options_t *options)
{ {
if (lxc_log_trace()) { if (lxc_log_trace()) {
for (int i = 0; i < LXC_NS_MAX; i++) { for (lxc_namespace_t i = 0; i < LXC_NS_MAX; i++) {
if (ns_info[i].clone_flag & options->namespaces) { if (ns_info[i].clone_flag & options->namespaces) {
TRACE("Attaching to %s namespace", ns_info[i].proc_name); TRACE("Attaching to %s namespace", ns_info[i].proc_name);
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment