diff options
author | Angelo Marletta <angelo.marletta@gmail.com> | 2012-07-08 15:12:27 +0100 |
---|---|---|
committer | Angelo Marletta <angelo.marletta@gmail.com> | 2012-07-08 15:12:27 +0100 |
commit | 0d7af11b180b2ca87b931fbd54a8467130596013 (patch) | |
tree | 4ed3037663a8485c5148cacd07dc1cfc99a0b7a0 | |
parent | c9e52f50b7d11023a203a3b8892236f6e833e0a5 (diff) | |
download | cpulimit-0d7af11b180b2ca87b931fbd54a8467130596013.tar.gz |
no more SIGSEGV when cpulimit exits
-rw-r--r-- | src/cpulimit.c | 11 |
1 files 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); |