2019-12-25 15:57:42 +08:00
|
|
|
From 95b371b3a04e99c63d8dab26c9c9e5f340a46f12 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
|
2019-12-25 15:57:42 +08:00
|
|
|
Subject: [PATCH 096/131] 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
|
2019-12-25 15:57:42 +08:00
|
|
|
index 0f227aa1..6cf86a4e 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)
|
|
|
|
|
--
|
2019-12-25 15:57:42 +08:00
|
|
|
2.23.0
|
2019-09-30 11:03:07 -04:00
|
|
|
|