Commit 8800da2b authored by Andrei Vagin's avatar Andrei Vagin

files: don't use PROC_SELF during restoring file descriptors

open_proc_pid(PROC_SELF) returns a non-service file descriptor,
but it can take a place of a target file descriptor.
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent 42bc32f6
...@@ -1593,7 +1593,11 @@ int open_path(struct file_desc *d, ...@@ -1593,7 +1593,11 @@ int open_path(struct file_desc *d,
tmp = inherit_fd_lookup_id(rfi->rfe->name); tmp = inherit_fd_lookup_id(rfi->rfe->name);
if (tmp >= 0) { if (tmp >= 0) {
inh_fd = tmp; inh_fd = tmp;
mntns_root = open_pid_proc(PROC_SELF); /*
* PROC_SELF isn't used, because only service
* descriptors can be used here.
*/
mntns_root = open_pid_proc(getpid());
snprintf(path, sizeof(path), "fd/%d", tmp); snprintf(path, sizeof(path), "fd/%d", tmp);
orig_path = rfi->path; orig_path = rfi->path;
rfi->path = path; rfi->path = path;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment