mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 12:55:43 +08:00
Addressed review comments from @v01d and @xiaoxiang781216
This commit is contained in:

committed by
Xiang Xiao

parent
0781dbf9e9
commit
23ec80fa30
@@ -84,7 +84,18 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
fd = open(filepath, O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
nsh_error(vtbl, g_fmtcmdfailed, cmd, "open", NSH_ERRNO);
|
||||
if (strncmp(filepath, CONFIG_NSH_PROC_MOUNTPOINT,
|
||||
strlen(CONFIG_NSH_PROC_MOUNTPOINT)) == 0)
|
||||
{
|
||||
nsh_error(vtbl,
|
||||
"nsh: %s: Could not open %s (is procfs mounted?): %d\n",
|
||||
cmd, filepath, NSH_ERRNO);
|
||||
}
|
||||
else
|
||||
{
|
||||
nsh_error(vtbl, g_fmtcmdfailed, cmd, "open", NSH_ERRNO);
|
||||
}
|
||||
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@@ -319,7 +330,18 @@ int nsh_foreach_direntry(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
{
|
||||
/* Failed to open the directory */
|
||||
|
||||
nsh_error(vtbl, g_fmtnosuch, cmd, "directory", dirpath);
|
||||
if (strncmp(dirpath, CONFIG_NSH_PROC_MOUNTPOINT,
|
||||
strlen(CONFIG_NSH_PROC_MOUNTPOINT)) == 0)
|
||||
{
|
||||
nsh_error(vtbl,
|
||||
"nsh: %s: Could not open %s (is procfs mounted?): %d\n",
|
||||
cmd, dirpath, NSH_ERRNO);
|
||||
}
|
||||
else
|
||||
{
|
||||
nsh_error(vtbl, g_fmtnosuch, cmd, "directory", dirpath);
|
||||
}
|
||||
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user