From ab6ff1d2bd04781d4c6b4adcd8e8458121ae3cf1 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Sun, 5 Jun 2016 22:50:59 +0800 Subject: [PATCH] setup the exec env in hyper_do_exec_cmd() Signed-off-by: Lai Jiangshan --- src/exec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/exec.c b/src/exec.c index e02675c..7a6bf5c 100644 --- a/src/exec.c +++ b/src/exec.c @@ -519,9 +519,8 @@ int hyper_enter_container(struct hyper_pod *pod, /* TODO: wait for container finishing setup root */ chdir("/"); - if (hyper_setup_env(c->exec.envs, c->exec.envs_num) < 0) - goto out; - ret = hyper_setup_env(exec->envs, exec->envs_num); + // TODO: let the hyperd do it (merging the env) when needed. + ret = hyper_setup_env(c->exec.envs, c->exec.envs_num); out: close(ipcns); close(utsns); @@ -596,6 +595,12 @@ static int hyper_do_exec_cmd(void *data) goto exit; } + // set the container env + if (hyper_setup_env(exec->envs, exec->envs_num) < 0) { + fprintf(stderr, "setup env failed\n"); + goto exit; + } + if (hyper_dup_exec_tty(exec) < 0) { fprintf(stderr, "dup pts to exec stdio failed\n"); goto exit;