Commit 28ee13d5 authored by Timo Teräs's avatar Timo Teräs

testing/cpulimit: fix a crash under certain conditions

parent ac23a63b
# Maintainer: Natanael Copa
pkgname=cpulimit
pkgver=0.0.2012.06.05
pkgrel=0
pkgrel=1
pkgdesc="CPU usage limiter for Linux"
url="https://github.com/opsengine/cpulimit"
arch="all"
......@@ -11,7 +11,8 @@ depends_dev=""
makedepends="$depends_dev"
install=""
subpackages=""
source="http://dev.alpinelinux.org/archive/cpulimit/cpulimit-$pkgver.tar.gz"
source="http://dev.alpinelinux.org/archive/cpulimit/cpulimit-$pkgver.tar.gz
fix-crash-on-sigquit.patch"
_builddir="$srcdir"/cpulimit
prepare() {
......@@ -34,4 +35,5 @@ package() {
install -Dm755 src/cpulimit "$pkgdir"/usr/bin/cpulimit
}
md5sums="34796b9b49c622d1d2b3adb97b3cf965 cpulimit-0.0.2012.06.05.tar.gz"
md5sums="34796b9b49c622d1d2b3adb97b3cf965 cpulimit-0.0.2012.06.05.tar.gz
664a233f3057e9c0ad245ef4a72e51cd fix-crash-on-sigquit.patch"
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment