aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Praet <paul.praet@telenet.be>2013-10-27 13:39:51 +0100
committerPaul Praet <paul.praet@telenet.be>2013-10-27 13:39:51 +0100
commit880c2c9028816c16299771d6a482e4acea90b8f4 (patch)
tree9da871feb1bb7e705f782de77e40f68223cce78f
parent49d7c698bbf93eda49a2aacdd9229a561dbec161 (diff)
downloadcpulimit-880c2c9028816c16299771d6a482e4acea90b8f4.tar.gz
Fix crash at CTRL_C
-rw-r--r--src/cpulimit.c14
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);
Un proyecto texto-plano.xyz