diff --git a/kernel/filesystem/devfs/devfs.c b/kernel/filesystem/devfs/devfs.c index df2dea3f..6abf905e 100644 --- a/kernel/filesystem/devfs/devfs.c +++ b/kernel/filesystem/devfs/devfs.c @@ -85,7 +85,8 @@ static long devfs_readdir(struct vfs_file_t *file_ptr, void *dirent, vfs_filldir ++file_ptr->position; // 获取目标dentry(由于是子目录项,因此是child_node_list) struct vfs_dir_entry_t *target_dent = container_of(list, struct vfs_dir_entry_t, child_node_list); - kdebug("target name=%s, namelen=%d", target_dent->name, target_dent->name_length); + // kdebug("target name=%s, namelen=%d", target_dent->name, target_dent->name_length); + char *name = (char *)kzalloc(target_dent->name_length + 1, 0); strncpy(name, target_dent->name, target_dent->name_length); uint32_t dentry_type; diff --git a/user/apps/shell/cmd.c b/user/apps/shell/cmd.c index 53152cc1..94689b49 100644 --- a/user/apps/shell/cmd.c +++ b/user/apps/shell/cmd.c @@ -210,7 +210,7 @@ int shell_cmd_cd(int argc, char **argv) new_path[current_dir_len] = '/'; strcat(new_path, argv[1] + dest_offset); int x = chdir(new_path); - printf("chdir: retval=%d\n",x); + if (x == 0) // 成功切换目录 { free(shell_current_path);