Skip to content

Commit

Permalink
Prevent nested signals, fix check for PID > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Jul 23, 2017
1 parent 07262fd commit ef8c120
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/context/switch.rs
Expand Up @@ -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;
}
}
Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/syscall/process.rs
Expand Up @@ -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();
Expand Down

0 comments on commit ef8c120

Please sign in to comment.