diff --git a/components/finsh/msh.c b/components/finsh/msh.c index 9cc0c6b340..d8586e54a4 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -755,10 +755,10 @@ void msh_auto_complete_path(char *path) } else if (S_ISLNK(buffer.st_mode)) { - DIR *dir = opendir(path); - if (dir) + DIR *link_dir = opendir(path); + if (link_dir) { - closedir(dir); + closedir(link_dir); strcat(path, "/"); } }