Skip to content

Commit 64c82bc

Browse files
committed
fix(vfs): 解决AT_FDCWD时,传入path为空导致内核panic的问题
Signed-off-by: longjin <longjin@DragonOS.org>
1 parent d7dcfc7 commit 64c82bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/src/filesystem/vfs/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn user_path_at(
4545
let mut inode = ROOT_INODE();
4646
let ret_path;
4747
// 如果path不是绝对路径,则需要拼接
48-
if path.as_bytes()[0] != b'/' {
48+
if path.is_empty() || path.as_bytes()[0] != b'/' {
4949
// 如果dirfd不是AT_FDCWD,则需要检查dirfd是否是目录
5050
if dirfd != AtFlags::AT_FDCWD.bits() {
5151
let binding = pcb.fd_table();

0 commit comments

Comments
 (0)