Commit a9be7621 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

mount: pick out a function to set ROOT_FD_OFF

Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent decf4f52
...@@ -3214,9 +3214,21 @@ err: ...@@ -3214,9 +3214,21 @@ err:
return -1; return -1;
} }
static int mntns_root_pid = -1;
static int mntns_set_root_fd(pid_t pid, int fd)
{
int ret;
ret = install_service_fd(ROOT_FD_OFF, fd);
if (ret >= 0)
mntns_root_pid = pid;
close(fd);
return ret;
}
int __mntns_get_root_fd(pid_t pid) int __mntns_get_root_fd(pid_t pid)
{ {
static int mntns_root_pid = -1;
int fd, pfd; int fd, pfd;
int ret; int ret;
...@@ -3272,11 +3284,7 @@ int __mntns_get_root_fd(pid_t pid) ...@@ -3272,11 +3284,7 @@ int __mntns_get_root_fd(pid_t pid)
} }
set_root: set_root:
ret = install_service_fd(ROOT_FD_OFF, fd); return mntns_set_root_fd(pid, fd);
if (ret >= 0)
mntns_root_pid = pid;
close(fd);
return ret;
} }
int mntns_get_root_fd(struct ns_id *mntns) { int mntns_get_root_fd(struct ns_id *mntns) {
......
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