From 8060b8ef7f41c79d282955897c3d451d8fed4d4c Mon Sep 17 00:00:00 2001 From: Stefani Seibold Date: Mon, 4 May 2015 12:42:08 +0200 Subject: [PATCH] fix exit handling --- client/process.c | 21 ++++++--------------- event.c | 13 ++++--------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/client/process.c b/client/process.c index 055ec3a..642bf64 100644 --- a/client/process.c +++ b/client/process.c @@ -1327,32 +1327,23 @@ struct process *process_new(pid_t pid, unsigned int swap_endian, unsigned int tr } -void process_show_exit(struct process *process) -{ - if (options.client || (!options.client && !options.verbose)) - fprintf(options.output, "+++ process %d exited +++\n", process->pid); -} - void process_exit(struct process *process) { - process_show_exit(process); process_set_status(process, MT_PROCESS_EXIT); + if (options.client || (!options.client && !options.verbose)) + fprintf(options.output, "+++ process %d exited +++\n", process->pid); + if (!options.interactive) _process_dump(process, sort_allocations, skip_zero_allocations, options.output); } void process_about_exit(struct process *process) { - if (options.auto_scan) { - process_show_exit(process); - process_set_status(process, MT_PROCESS_EXITING); + process_set_status(process, MT_PROCESS_EXITING); + + if (options.auto_scan) process_leaks_scan(process, SCAN_ALL); - } - else { - process_exit(process); - client_send_msg(process, MT_EXIT, NULL, 0); - } } void process_detach(struct process *process) diff --git a/event.c b/event.c index 6745148..02d4b02 100644 --- a/event.c +++ b/event.c @@ -173,17 +173,12 @@ static void show_exit(struct task *task) static struct task *handle_about_exit(struct task *task) { - show_exit(task); + if (task->leader == task) + report_about_exit(task); - if (task->leader == task) { - if (report_about_exit(task) != -1) - return task; - remove_proc(task); - } - else - remove_task(task); + continue_task(task, 0); - return NULL; + return task; } static struct task *handle_exit(struct task *task)