mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 18:03:25 +00:00
Check name when lookup_child
in TaskDirOps
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
9753d796c5
commit
3e47ed10fd
@ -63,8 +63,12 @@ impl DirOps for ThreadDirOps {
|
|||||||
|
|
||||||
impl DirOps for TaskDirOps {
|
impl DirOps for TaskDirOps {
|
||||||
fn lookup_child(&self, this_ptr: Weak<dyn Inode>, name: &str) -> Result<Arc<dyn Inode>> {
|
fn lookup_child(&self, this_ptr: Weak<dyn Inode>, name: &str) -> Result<Arc<dyn Inode>> {
|
||||||
|
let Ok(tid) = name.parse::<u32>() else {
|
||||||
|
return_errno_with_message!(Errno::ENOENT, "Can not parse name to u32 type");
|
||||||
|
};
|
||||||
|
|
||||||
for task in self.0.tasks().lock().as_slice() {
|
for task in self.0.tasks().lock().as_slice() {
|
||||||
if task.as_posix_thread().unwrap().tid() != name.parse::<u32>().unwrap() {
|
if task.as_posix_thread().unwrap().tid() != tid {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return Ok(ThreadDirOps::new_inode(self.0.clone(), this_ptr));
|
return Ok(ThreadDirOps::new_inode(self.0.clone(), this_ptr));
|
||||||
|
Reference in New Issue
Block a user