[CRIU] [PATCH 1/7] sfd: dump -- Don't forget to close old [CR_]PROC_FD_OFF

Cyrill Gorcunov gorcunov at openvz.org
Mon May 29 13:14:59 PDT 2017


From: Cyrill Gorcunov <gorcunov at virtuozzo.com>

When installing new [CR_]PROC_FD_OFF service descriptors
make sure the old ones are closed.

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 criu/cr-dump.c | 1 +
 criu/util.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 1d661e7b19b7..ea14605044cf 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1312,6 +1312,7 @@ static int dump_one_task(struct pstree_item *item)
 			goto err_cure_imgset;
 		}
 
+		close_service_fd(CR_PROC_FD_OFF);
 		if (install_service_fd(CR_PROC_FD_OFF, pfd) < 0)
 			goto err_cure_imgset;
 
diff --git a/criu/util.c b/criu/util.c
index 3363eef99f6b..68dd09b3ba94 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -302,6 +302,7 @@ void close_proc()
 
 int set_proc_fd(int fd)
 {
+	close_service_fd(PROC_FD_OFF);
 	if (install_service_fd(PROC_FD_OFF, fd) < 0)
 		return -1;
 	return 0;
-- 
2.7.4



More information about the CRIU mailing list