mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 04:26:04 +08:00
apps/nshlib/cmd_cd: Modify the logic of cd
Modify the implementation logic of changing directory. There's an error handling the path incluing "../" or "./" bug examples: nsh> cd proc/self/group nsh> cd ../.. nsh: cd: chdir failed: 2 nsh> pwd /proc/self nsh> ls /proc/self: status cmdline stack group/ nsh> cd ./group nsh: cd: chdir failed: 2 Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
This commit is contained in:
@@ -583,7 +583,7 @@ FAR char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
|
||||
snprintf(vtbl->iobuffer, IOBUFFERSIZE, "%s/%s", dirpath, path);
|
||||
}
|
||||
|
||||
return strdup(vtbl->iobuffer);
|
||||
return lib_realpath(vtbl->iobuffer, NULL, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user