diff --git a/src/sys/unix/hostcalls/fs_helpers.rs b/src/sys/unix/hostcalls/fs_helpers.rs index 5d1c70bd88..94a3b20268 100644 --- a/src/sys/unix/hostcalls/fs_helpers.rs +++ b/src/sys/unix/hostcalls/fs_helpers.rs @@ -149,7 +149,7 @@ pub fn path_get>( || (component.ends_with(b"/") && !needs_final_component) => { match openat( - *dir_stack.first().expect("dir_stack is never empty"), + *dir_stack.last().expect("dir_stack is never empty"), component, OFlag::O_RDONLY | OFlag::O_DIRECTORY | OFlag::O_NOFOLLOW, Mode::empty(),