2020-01-05 22:20:49 -05:00
|
|
|
From 409fe518357440d5c25886587932b8bec207fa9c Mon Sep 17 00:00:00 2001
|
2019-09-30 11:03:07 -04:00
|
|
|
From: liuhao <liuhao27@huawei.com>
|
|
|
|
|
Date: Mon, 13 May 2019 16:45:50 +0800
|
2020-01-05 22:20:49 -05:00
|
|
|
Subject: [PATCH 096/138] close inherited fd in hook process
|
2019-09-30 11:03:07 -04:00
|
|
|
|
|
|
|
|
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
|
2020-01-05 22:20:49 -05:00
|
|
|
index 0f227aa..6cf86a4 100644
|
2019-09-30 11:03:07 -04:00
|
|
|
--- 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)
|
|
|
|
|
--
|
2020-01-05 22:20:49 -05:00
|
|
|
1.8.3.1
|
2019-09-30 11:03:07 -04:00
|
|
|
|