mirror of https://github.com/xzeldon/htop.git
UptimeMeter: treat all non-positive values as error
Bogus uptime measurements can result in wrap-arounds, leading to negative garbage values printed.
This commit is contained in:
parent
11d2206f40
commit
fbe3a2155f
|
@ -19,7 +19,7 @@ static const int UptimeMeter_attributes[] = {
|
||||||
|
|
||||||
static void UptimeMeter_updateValues(Meter* this) {
|
static void UptimeMeter_updateValues(Meter* this) {
|
||||||
int totalseconds = Platform_getUptime();
|
int totalseconds = Platform_getUptime();
|
||||||
if (totalseconds == -1) {
|
if (totalseconds <= 0) {
|
||||||
xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "(unknown)");
|
xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "(unknown)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue