[CRIU] [PATCH 1/4] seize: slightly cleanup collect_pstree() exit path.
Andrey Ryabinin
aryabinin at virtuozzo.com
Wed Dec 16 03:59:48 PST 2015
Use 'goto err;' everywhere. Remove 'pstree_switch_state(root_item, TASK_ALIVE)'
on error path as all collect_pstree() callers do this if collect_pstree()
failed.
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
seize.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/seize.c b/seize.c
index c0f8d7b..c94e22d 100644
--- a/seize.c
+++ b/seize.c
@@ -617,16 +617,16 @@ err_close:
int collect_pstree(pid_t pid)
{
- int ret;
+ int ret = -1;
timing_start(TIME_FREEZING);
if (opts.freeze_cgroup && freeze_processes())
- return -1;
+ goto err;
root_item = alloc_pstree_item();
if (root_item == NULL)
- return -1;
+ goto err;
root_item->pid.real = pid;
@@ -646,14 +646,13 @@ int collect_pstree(pid_t pid)
goto err;
if (opts.freeze_cgroup && freezer_wait_processes())
- return -1;
+ goto err;
+ ret = 0;
timing_stop(TIME_FREEZING);
timing_start(TIME_FROZEN);
- return 0;
err:
- pstree_switch_state(root_item, TASK_ALIVE);
- return -1;
+ return ret;
}
--
2.4.10
More information about the CRIU
mailing list