coverity fixes

This commit is contained in:
Hisham Muhammad 2009-10-16 20:03:18 +00:00
parent dd86b9b646
commit 1e124da059
2 changed files with 3 additions and 3 deletions

View File

@ -313,7 +313,7 @@ static void ProcessList_remove(ProcessList* this, Process* p) {
unsigned int pid = p->pid;
int index = Vector_indexOf(this->processes, p, Process_pidCompare);
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_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) {
unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime;
unsigned long long int swapFree;
unsigned long long int swapFree = 0;
FILE* status;
char buffer[128];

View File

@ -19,7 +19,7 @@ int UptimeMeter_attributes[] = {
};
static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
double uptime;
double uptime = 0;
FILE* fd = fopen(PROCDIR "/uptime", "r");
fscanf(fd, "%lf", &uptime);
fclose(fd);