mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-28 12:36:47 +00:00
helper: Move service fds closing code to restore_one_helper()
There is no reasons we need this cleanup code in generic restore_one_task(), so let's move it for better readability. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
9eb9abb62f
commit
a66bfa5800
1 changed files with 13 additions and 7 deletions
|
|
@ -1164,15 +1164,26 @@ static int wait_exiting_children(void)
|
|||
*/
|
||||
static int restore_one_helper(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (prepare_fds(current))
|
||||
return -1;
|
||||
|
||||
return wait_exiting_children();
|
||||
if (wait_exiting_children())
|
||||
return -1;
|
||||
|
||||
sfds_protected = false;
|
||||
close_image_dir();
|
||||
close_proc();
|
||||
for (i = SERVICE_FD_MIN + 1; i < SERVICE_FD_MAX; i++)
|
||||
close_service_fd(i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int restore_one_task(int pid, CoreEntry *core)
|
||||
{
|
||||
int i, ret;
|
||||
int ret;
|
||||
|
||||
/* No more fork()-s => no more per-pid logs */
|
||||
|
||||
|
|
@ -1182,11 +1193,6 @@ static int restore_one_task(int pid, CoreEntry *core)
|
|||
ret = restore_one_zombie(core);
|
||||
else if (current->pid->state == TASK_HELPER) {
|
||||
ret = restore_one_helper();
|
||||
sfds_protected = false;
|
||||
close_image_dir();
|
||||
close_proc();
|
||||
for (i = SERVICE_FD_MIN + 1; i < SERVICE_FD_MAX; i++)
|
||||
close_service_fd(i);
|
||||
} else {
|
||||
pr_err("Unknown state in code %d\n", (int)core->tc->task_state);
|
||||
ret = -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue