[CRIU] [PATCH] files: use PROC_SELF when a process accesses its /proc/PID

Andrey Vagin avagin at openvz.org
Sat Jan 31 03:54:44 PST 2015


If a process is executed in another pidns, a /proc/PID doesn't link with
the proper process.

This patch fixes a problem like this:
   1: Error (util.c:106): Unable to close fd 33: Bad file descriptor

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 files.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/files.c b/files.c
index 412a99a..6274982 100644
--- a/files.c
+++ b/files.c
@@ -938,7 +938,7 @@ int close_old_fds(struct pstree_item *me)
 	struct dirent *de;
 	int fd, ret;
 
-	dir = opendir_proc(getpid(), "fd");
+	dir = opendir_proc(PROC_SELF, "fd");
 	if (dir == NULL)
 		return -1;
 
-- 
1.9.3



More information about the CRIU mailing list