diff options
author | Angelo Marletta <angelo.marletta@gmail.com> | 2014-01-09 21:42:06 -0800 |
---|---|---|
committer | Angelo Marletta <angelo.marletta@gmail.com> | 2014-01-09 21:42:06 -0800 |
commit | 3cdc520637fcfd7e72c9c60d90fad1a194d2f8b6 (patch) | |
tree | 9da871feb1bb7e705f782de77e40f68223cce78f | |
parent | 49d7c698bbf93eda49a2aacdd9229a561dbec161 (diff) | |
parent | 880c2c9028816c16299771d6a482e4acea90b8f4 (diff) | |
download | cpulimit-3cdc520637fcfd7e72c9c60d90fad1a194d2f8b6.tar.gz |
Merge pull request #26 from spetsnaz84/master
Fix crash at CTRL_C
-rw-r--r-- | src/cpulimit.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cpulimit.c b/src/cpulimit.c index 002205d..5c85da2 100644 --- a/src/cpulimit.c +++ b/src/cpulimit.c @@ -88,12 +88,14 @@ int lazy = 0; 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); - } - close_process_group(&pgroup); + if (pgroup.proclist != NULL){ + 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); + } + close_process_group(&pgroup); + } //fix ^C little problem printf("\r"); fflush(stdout); |