From 95b371b3a04e99c63d8dab26c9c9e5f340a46f12 Mon Sep 17 00:00:00 2001 From: liuhao Date: Mon, 13 May 2019 16:45:50 +0800 Subject: [PATCH 096/131] 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 0f227aa1..6cf86a4e 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) -- 2.23.0