Skip to content

Commit 9e6fe45

Browse files
fs::lookup_path: handle absolute symlinks
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent d881812 commit 9e6fe45

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/aero_kernel/src/fs/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,14 @@ pub fn lookup_path_with(
272272
let metadata = inode.metadata()?;
273273

274274
if metadata.is_symlink() {
275-
let relative_path_str = inode.resolve_link()?;
276-
let relative_path = Path::new(&relative_path_str);
275+
let resolved_path_str = inode.resolve_link()?;
276+
let resolved_path = Path::new(&resolved_path_str);
277277

278-
return lookup_path_with(parent, relative_path, LookupMode::None);
278+
if resolved_path.is_absolute() {
279+
return lookup_path(resolved_path);
280+
}
281+
282+
return lookup_path_with(parent, resolved_path, LookupMode::None);
279283
} else if metadata.is_directory() {
280284
if let Ok(mount_point) = MOUNT_MANAGER.find_mount(cwd.clone()) {
281285
cwd = mount_point.root_entry;

0 commit comments

Comments
 (0)