Fix unitialized proc_state.state when task_for_pid fails

This commit is contained in:
Doug MacEachern 2007-12-13 06:21:44 +00:00
parent babdfafa52
commit 89eb98a3f1
1 changed files with 6 additions and 3 deletions

View File

@ -1116,8 +1116,12 @@ int sigar_proc_state_get(sigar_t *sigar, sigar_pid_t pid,
procstate->processor = SIGAR_FIELD_NOTIMPL;
#ifdef DARWIN
sigar_proc_threads_get(sigar, pid, procstate);
#else
status = sigar_proc_threads_get(sigar, pid, procstate);
if (status == SIGAR_OK) {
return status;
}
#endif
switch (pinfo->KI_STAT) {
case SIDL:
procstate->state = 'D';
@ -1135,7 +1139,6 @@ int sigar_proc_state_get(sigar_t *sigar, sigar_pid_t pid,
procstate->state = 'Z';
break;
}
#endif
return SIGAR_OK;
}