cmd_cp:Skip mkdir when mkdir is not available
The behavior of mkdir is used during the cp -r process, and the mkdir behavior is skipped when mkdir is unavailable (this may cause unpredictable behavior of cp -r) Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
parent
e8470f7d0e
commit
bac8aab243
@ -290,6 +290,7 @@ static int cp_recursive(FAR struct nsh_vtbl_s *vtbl, FAR const char *srcpath,
|
||||
|
||||
if (S_ISDIR(buf.st_mode))
|
||||
{
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_DISABLE_PSEUDOFS_OPERATIONS)
|
||||
ret = mkdir(allocdestpath, S_IRWXU | S_IRWXG | S_IROTH |
|
||||
S_IXOTH);
|
||||
if (ret != OK)
|
||||
@ -297,6 +298,7 @@ static int cp_recursive(FAR struct nsh_vtbl_s *vtbl, FAR const char *srcpath,
|
||||
nsh_error(vtbl, g_fmtcmdfailed, "cp", "mkdir", NSH_ERRNO);
|
||||
goto errout_with_allocdestpath;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = cp_recursive(vtbl, allocsrcpath, allocdestpath);
|
||||
if (ret != OK)
|
||||
|
Loading…
Reference in New Issue
Block a user