From 0d7af11b180b2ca87b931fbd54a8467130596013 Mon Sep 17 00:00:00 2001 From: Angelo Marletta Date: Sun, 8 Jul 2012 15:12:27 +0100 Subject: no more SIGSEGV when cpulimit exits --- src/cpulimit.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cpulimit.c b/src/cpulimit.c index e02eafc..b031441 100644 --- a/src/cpulimit.c +++ b/src/cpulimit.c @@ -89,11 +89,14 @@ static void quit(int sig) { //let all the processes continue if stopped struct list_node *node = NULL; - for (node=pgroup.proclist->first; node!= NULL; node=node->next) { - struct process *p = (struct process*)(node->data); - kill(p->pid, SIGCONT); + if (pgroup.proclist != NULL) + { + for (node = pgroup.proclist->first; node != NULL; node = node->next) { + struct process *p = (struct process*)(node->data); + kill(p->pid, SIGCONT); + } + close_process_group(&pgroup); } - close_process_group(&pgroup); //fix ^C little problem printf("\r"); fflush(stdout); -- cgit v1.2.3