aboutsummaryrefslogtreecommitdiffstats
path: root/main/cpulimit/fix-crash-on-sigquit.patch
blob: d406dec2e0436e41f6a08eeef810262e26e7aa45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Only in cpulimit.fix/: core
Only in cpulimit.fix/: src/cpulimit
--- cpulimit/src/cpulimit.c
+++ cpulimit.fix/src/cpulimit.c
@@ -89,11 +89,13 @@
 {
 	//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) {
+		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);
Only in cpulimit.fix/: src/list.o
Only in cpulimit.fix/: src/process_group.o
Only in cpulimit.fix/: src/process_iterator.o
Only in cpulimit.fix/: tests/busy
Only in cpulimit.fix/: tests/process_iterator_test