Prevent nested signals, fix check for PID > 0
This commit is contained in:
@@ -98,7 +98,9 @@ pub unsafe fn switch() -> bool {
|
||||
let mut context = context_lock.write();
|
||||
if check_context(&mut context) {
|
||||
to_ptr = context.deref_mut() as *mut Context;
|
||||
to_sig = context.pending.pop_front();
|
||||
if (&mut *to_ptr).ksig.is_none() {
|
||||
to_sig = context.pending.pop_front();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +112,9 @@ pub unsafe fn switch() -> bool {
|
||||
let mut context = context_lock.write();
|
||||
if check_context(&mut context) {
|
||||
to_ptr = context.deref_mut() as *mut Context;
|
||||
to_sig = context.pending.pop_front();
|
||||
if (&mut *to_ptr).ksig.is_none() {
|
||||
to_sig = context.pending.pop_front();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1041,7 +1041,7 @@ pub fn kill(pid: ContextId, sig: usize) -> Result<usize> {
|
||||
}
|
||||
};
|
||||
|
||||
if pid.into() > 0 {
|
||||
if pid.into() as isize > 0 {
|
||||
// Send to a single process
|
||||
if let Some(context_lock) = contexts.get(pid) {
|
||||
let mut context = context_lock.write();
|
||||
|
||||
Reference in New Issue
Block a user