fix: 解决shell命令中rm -r指令尝试删除/dev下节点系统出错的问题
主干不存在该问题,已解决. shell命令rm中当opendir时没有正确判断opendir的返回值, 导致后续访问空指针. 检查opendir的返回值,当opendir失败时返回-1. Close #I48FLX Signed-off-by: gao-rongxin <gaorongxin1@huawei.com>
This commit is contained in:
parent
3e6bab5158
commit
93658ba478
|
@ -838,6 +838,10 @@ static int os_shell_cmd_do_rmdir(const char *pathname)
|
||||||
return remove(pathname);
|
return remove(pathname);
|
||||||
}
|
}
|
||||||
d = opendir(pathname);
|
d = opendir(pathname);
|
||||||
|
if (d == NULL)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
dirent = readdir(d);
|
dirent = readdir(d);
|
||||||
|
|
Loading…
Reference in New Issue