From 409fe518357440d5c25886587932b8bec207fa9c Mon Sep 17 00:00:00 2001 From: liuhao Date: Mon, 13 May 2019 16:45:50 +0800 Subject: [PATCH 096/138] close inherited fd in hook process close inherited fd in hook process Signed-off-by: liuhao Signed-off-by: LiFeng --- src/lxc/conf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 0f227aa..6cf86a4 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -4560,6 +4560,13 @@ static struct lxc_popen_FILE *lxc_popen_ocihook(char *commandpath, char **args, if (child_pid == 0) { /* child */ + int inherit_fds[2] = { + pipe_msg[0], pipe_fds[1] + }; + if (lxc_check_inherited(NULL, true, inherit_fds, 2) != 0) { + SYSERROR("check inherited fd failed"); + exit(127); + } close(pipe_msg[1]); if (pipe_msg[0] != STDIN_FILENO) -- 1.8.3.1