Fix bugs affecting 8-core machines

zero-index involving NCPU sysctl being used as loop condition fixed
early free fixed
This commit is contained in:
ians 2018-07-26 11:34:27 +00:00
parent 0e35d68a55
commit 8c7ec0bed7
4 changed files with 35 additions and 10 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.9 2018/07/17 14:14:37 ians Exp $
# $OpenBSD: Makefile,v 1.10 2018/07/26 11:34:27 ians Exp $
COMMENT = interactive process viewer
V = 2.2.0
@ -6,7 +6,7 @@ DISTNAME = htop-${V}
CATEGORIES = sysutils
HOMEPAGE = https://hisham.hm/htop/index.php
MAINTAINER = Ian Sutton <ian@ce.gl>
REVISION = 4
REVISION = 5
# GPLv2+
PERMIT_PACKAGE_CDROM = Yes

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-CPUMeter_c,v 1.1 2018/07/26 11:34:27 ians Exp $
Index: CPUMeter.c
--- CPUMeter.c.orig
+++ CPUMeter.c
@@ -135,6 +135,9 @@ static void AllCPUsMeter_getRange(Meter* this, int* st
*count = cpus / 2;
break;
}
+
+ if (*count == cpus)
+ *count = *count - 1;
}
static void AllCPUsMeter_init(Meter* this) {

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-Vector_c,v 1.1 2018/07/26 11:34:27 ians Exp $
Index: Vector.c
--- Vector.c.orig
+++ Vector.c
@@ -53,8 +53,8 @@ void Vector_delete(Vector* this) {
if (this->array[i])
Object_delete(this->array[i]);
}
- free(this->array);
- free(this);
+ /* free(this->array);
+ free(this); */
}
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-openbsd_Platform_c,v 1.2 2018/07/17 14:14:37 ians Exp $
$OpenBSD: patch-openbsd_Platform_c,v 1.3 2018/07/26 11:34:27 ians Exp $
Index: openbsd/Platform.c
--- openbsd/Platform.c.orig
@ -12,13 +12,7 @@ Index: openbsd/Platform.c
/*
* Copyright (c) 1984, 1989, William LeFebvre, Rice University
@@ -220,12 +220,12 @@ double Platform_setCPUValues(Meter* this, int cpu) {
percentages(CPUSTATES, diff_v, new_v,
(int64_t *)old_v[cpu-1], scratch_v);
- for (i = 0; i < CPUSTATES; i++) {
+ for (i = 0; i < CPUSTATES - 1; i++) {
old_v[cpu-1][i] = new_v[i];
@@ -225,7 +225,7 @@ double Platform_setCPUValues(Meter* this, int cpu) {
v[i] = diff_v[i] / 10.;
}