mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
mount: pick out a function to set ROOT_FD_OFF
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
decf4f525a
commit
a9be7621b7
20
mount.c
20
mount.c
@@ -3214,9 +3214,21 @@ err:
|
||||
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)
|
||||
{
|
||||
static int mntns_root_pid = -1;
|
||||
|
||||
int fd, pfd;
|
||||
int ret;
|
||||
@@ -3272,11 +3284,7 @@ int __mntns_get_root_fd(pid_t pid)
|
||||
}
|
||||
|
||||
set_root:
|
||||
ret = install_service_fd(ROOT_FD_OFF, fd);
|
||||
if (ret >= 0)
|
||||
mntns_root_pid = pid;
|
||||
close(fd);
|
||||
return ret;
|
||||
return mntns_set_root_fd(pid, fd);
|
||||
}
|
||||
|
||||
int mntns_get_root_fd(struct ns_id *mntns) {
|
||||
|
Reference in New Issue
Block a user