mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
nshlib: add relative image path support in boot command
cmd_boot passed the image path straight to boardctl(), which resolves it in a context that does not inherit the NSH shell cwd, so relative paths failed and only absolute paths worked. Use nsh_getfullpath() to resolve relative paths against the cwd before calling boardctl(). Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
This commit is contained in:
parent
8d5e9f3754
commit
fabafbc361
1 changed files with 4 additions and 1 deletions
|
|
@ -405,6 +405,7 @@ int cmd_switchboot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
|
|||
int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
|
||||
{
|
||||
struct boardioc_boot_info_s info;
|
||||
FAR char *fullpath = NULL;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
|
||||
|
|
@ -421,7 +422,8 @@ int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
|
|||
/* Go through */
|
||||
|
||||
case 1:
|
||||
info.path = argv[1];
|
||||
fullpath = nsh_getfullpath(vtbl, argv[1]);
|
||||
info.path = fullpath;
|
||||
|
||||
/* Go through */
|
||||
|
||||
|
|
@ -439,6 +441,7 @@ int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
|
|||
*/
|
||||
|
||||
nsh_error(vtbl, g_fmtcmdfailed, argv[0], "boardctl", NSH_ERRNO);
|
||||
nsh_freefullpath(fullpath);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue