Fix returning too many errors from waitpid

This commit is contained in:
Jeremy Soller
2017-10-29 15:41:59 -06:00
parent 1f99d038c4
commit eebf12bec5

View File

@@ -1160,17 +1160,20 @@ pub fn waitpid(pid: ContextId, status_ptr: usize, flags: usize) -> Result<Contex
} else {
let status = {
let contexts = context::contexts();
let context_lock = contexts.get(pid).ok_or(Error::new(ECHILD))?;
let mut context = context_lock.write();
if context.ppid != ppid {
println!("Hack for rustc - changing ppid of {} from {} to {}", context.id.into(), context.ppid.into(), ppid.into());
context.ppid = ppid;
//return Err(Error::new(ECHILD));
if let Some(context_lock) = contexts.get(pid) {
let mut context = context_lock.write();
if context.ppid != ppid {
println!("Hack for rustc - changing ppid of {} from {} to {}", context.id.into(), context.ppid.into(), ppid.into());
context.ppid = ppid;
//return Err(Error::new(ECHILD));
}
Some(context.status.clone())
} else {
None
}
context.status.clone()
};
if let context::Status::Exited(status) = status {
if let Some(context::Status::Exited(status)) = status {
status_slice[0] = status;
reap(pid)
} else if flags & WNOHANG == WNOHANG {