static int pre_dump_using_req(int sk, CriuOpts *req) { int pid, status; bool success = false; pid = fork(); if (pid < 0) { pr_perror("Can't fork"); goto out; } if (pid == 0) { int ret = 1; if (setup_opts_from_req(sk, req)) goto cout; setproctitle("pre-dump --rpc -t %d -D %s", req->pid, images_dir); if (cr_pre_dump_tasks(req->pid)) goto cout; ret = 0; cout: exit(ret); } if (waitpid(pid, &status, 0) != pid) { pr_perror("Unable to wait %d", pid); goto out; } if (status != 0) goto out; success = true; out: if (send_criu_pre_dump_resp(sk, success) == -1) { pr_perror("Can't send pre-dump resp"); success = false; } return success ? 0 : -1; }
static int pre_dump_using_req(int sk, CriuOpts *req) { int pid, status; bool success = false; pid = fork(); if (pid < 0) { pr_perror("Can't fork"); goto out; } if (pid == 0) { int ret = 1; if (setup_opts_from_req(sk, req)) goto cout; if (cr_pre_dump_tasks(req->pid)) goto cout; ret = 0; cout: exit(ret); } wait(&status); if (!WIFEXITED(status)) goto out; if (WEXITSTATUS(status) != 0) goto out; success = true; out: if (send_criu_pre_dump_resp(sk, success) == -1) { pr_perror("Can't send pre-dump resp"); success = false; } return success ? 0 : -1; }