提交 93658ba4 编写于 作者: G gao-rongxin

fix: 解决shell命令中rm -r指令尝试删除/dev下节点系统出错的问题

主干不存在该问题,已解决.

shell命令rm中当opendir时没有正确判断opendir的返回值,
导致后续访问空指针.

检查opendir的返回值,当opendir失败时返回-1.

Close #I48FLX
Signed-off-by: Ngao-rongxin <gaorongxin1@huawei.com>
上级 3e6bab51
......@@ -838,6 +838,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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册