2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 21:38:16 +00:00

files: Close old service fd in clone_service_fd()

Next patches will make service_fd_base not contant.
It will be "floating" and change from task to task.
This patch makes preparation for that: it closes
old service fd after it's duplicated.

Currently the code is unused as in case of
!(rsti(me)->clone_flags & CLONE_FILES), the child
has the same id as its parent, and the duplication
just does not occur.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
This commit is contained in:
Kirill Tkhai 2018-01-10 17:02:35 +03:00 committed by Andrei Vagin
parent d300d172a7
commit 4fc7cdecf5

View File

@ -563,6 +563,8 @@ int clone_service_fd(struct pstree_item *me)
continue;
pr_perror("Unable to clone %d->%d", old, new);
}
if (ret >= 0 && !(rsti(me)->clone_flags & CLONE_FILES))
close(old);
}
service_fd_id = id;