fix:shell cmd rm -r crash when open target dir failed

Change-Id: I1146ab12b02aeef3f9a2a0422ee45936f5e4c105
This commit is contained in:
mucor 2021-04-29 16:52:13 +08:00
parent 8592e04c78
commit 749420308e
1 changed files with 4 additions and 0 deletions

View File

@ -837,6 +837,10 @@ static int os_shell_cmd_do_rmdir(const char *pathname)
return remove(pathname);
}
d = opendir(pathname);
if (d == NULL)
{
return -1;
}
while (1)
{
dirent = readdir(d);