Skip to content

Commit

Permalink
Do not crash on tid == -1
Browse files Browse the repository at this point in the history
  • Loading branch information
mikusp committed Feb 18, 2024
1 parent 4d5042c commit 7645db4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/kernel/src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl VProc {
}

fn sys_thr_set_name(self: &Arc<Self>, i: &SysIn) -> Result<SysOut, SysErr> {
let tid: i32 = i.args[0].try_into().unwrap();
let tid: i64 = i.args[0].try_into().unwrap();
let name: Option<&str> = unsafe { i.args[1].to_str(32) }?;

if tid == -1 {
Expand All @@ -433,7 +433,7 @@ impl VProc {

let thr = threads
.iter()
.find(|t| t.id().get() == tid)
.find(|t| t.id().get() == tid as i32)
.ok_or(SysErr::Raw(ESRCH))?;

info!(
Expand Down

0 comments on commit 7645db4

Please sign in to comment.