From 4952a0eadbe150322b295c124db10e02518d0515 Mon Sep 17 00:00:00 2001
From: tanyifeng <tanyifeng1@huawei.com>
Date: Mon, 14 Jan 2019 17:09:57 +0800
Subject: [PATCH 023/131] attach.c: change uid and gid from lxc container
 config

Signed-off-by: LiFeng <lifeng68@huawei.com>
---
 src/lxc/attach.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index 570b9d0e..e6e4b0d1 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -1146,6 +1146,12 @@ int lxc_attach(const char *name, const char *lxcpath,
 	}
 	conf = init_ctx->container->lxc_conf;
 
+	// isulad: always switch uid and gid for attach
+	if (options->uid == -1)
+		options->uid = init_ctx->container->lxc_conf->init_uid;
+	if (options->gid == -1)
+		options->gid = init_ctx->container->lxc_conf->init_gid;
+
 	if (!fetch_seccomp(init_ctx->container, options))
 		WARN("Failed to get seccomp policy");
 
-- 
2.23.0

