[CRIU] [PATCH 3/3] Open proc links with O_PATH
Pavel Emelyanov
xemul at parallels.com
Fri Nov 6 01:01:04 PST 2015
These three are like map_files one.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
cr-dump.c | 6 +++---
include/util.h | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index fea3be6..15fbbc8 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -240,7 +240,7 @@ static int dump_task_exe_link(pid_t pid, MmEntry *mm)
struct fd_parms params;
int fd, ret = 0;
- fd = open_proc(pid, "exe");
+ fd = open_proc_p(pid, "exe");
if (fd < 0)
return -1;
@@ -263,7 +263,7 @@ static int dump_task_fs(pid_t pid, struct parasite_dump_misc *misc, struct cr_im
fe.has_umask = true;
fe.umask = misc->umask;
- fd = open_proc(pid, "cwd");
+ fd = open_proc_p(pid, "cwd");
if (fd < 0)
return -1;
@@ -278,7 +278,7 @@ static int dump_task_fs(pid_t pid, struct parasite_dump_misc *misc, struct cr_im
close(fd);
- fd = open_proc(pid, "root");
+ fd = open_proc_p(pid, "root");
if (fd < 0)
return -1;
diff --git a/include/util.h b/include/util.h
index e815117..8572267 100644
--- a/include/util.h
+++ b/include/util.h
@@ -94,6 +94,9 @@ extern int do_open_proc(pid_t pid, int flags, const char *fmt, ...);
#define open_proc_rw(pid, fmt, ...) \
__open_proc(pid, O_RDWR, fmt, ##__VA_ARGS__)
+#define open_proc_p(pid, fmt, ...) \
+ __open_proc(pid, O_PATH, fmt, ##__VA_ARGS__)
+
/* DIR *opendir_proc(pid_t pid, const char *fmt, ...); */
#define opendir_proc(pid, fmt, ...) \
({ \
--
1.9.3
More information about the CRIU
mailing list