lxc/0096-close-inherited-fd-in-hook-process.patch
2019-09-30 11:03:07 -04:00

35 lines
917 B
Diff

From 7f4352c61de6732d41285f6f949199708e459ac0 Mon Sep 17 00:00:00 2001
From: liuhao <liuhao27@huawei.com>
Date: Mon, 13 May 2019 16:45:50 +0800
Subject: [PATCH 096/122] close inherited fd in hook process
close inherited fd in hook process
Signed-off-by: liuhao <liuhao27@huawei.com>
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
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