mirror of https://github.com/xzeldon/htop.git
coverity fixes
This commit is contained in:
parent
dd86b9b646
commit
1e124da059
|
@ -313,7 +313,7 @@ static void ProcessList_remove(ProcessList* this, Process* p) {
|
||||||
unsigned int pid = p->pid;
|
unsigned int pid = p->pid;
|
||||||
int index = Vector_indexOf(this->processes, p, Process_pidCompare);
|
int index = Vector_indexOf(this->processes, p, Process_pidCompare);
|
||||||
assert(index != -1);
|
assert(index != -1);
|
||||||
Vector_remove(this->processes, index);
|
if (index >= 0) Vector_remove(this->processes, index);
|
||||||
assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid;
|
assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid;
|
||||||
assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
|
assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
|
||||||
}
|
}
|
||||||
|
@ -730,7 +730,7 @@ static bool ProcessList_processEntries(ProcessList* this, char* dirname, Process
|
||||||
|
|
||||||
void ProcessList_scan(ProcessList* this) {
|
void ProcessList_scan(ProcessList* this) {
|
||||||
unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime;
|
unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime;
|
||||||
unsigned long long int swapFree;
|
unsigned long long int swapFree = 0;
|
||||||
|
|
||||||
FILE* status;
|
FILE* status;
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
|
|
|
@ -19,7 +19,7 @@ int UptimeMeter_attributes[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
|
static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
|
||||||
double uptime;
|
double uptime = 0;
|
||||||
FILE* fd = fopen(PROCDIR "/uptime", "r");
|
FILE* fd = fopen(PROCDIR "/uptime", "r");
|
||||||
fscanf(fd, "%lf", &uptime);
|
fscanf(fd, "%lf", &uptime);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
|
Loading…
Reference in New Issue