diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index 752933b66f9a1632f443a55a20b135ab3e3d5ebf..1085a3635acd83610aaf5a798780decf84685eaf 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -568,7 +568,6 @@ void rm(const char *filename) } } FINSH_FUNCTION_EXPORT(rm, remove files or directories); - void cat(const char* filename) { rt_uint32_t length; @@ -655,8 +654,8 @@ static void copydir(const char * src, const char * dst) struct dirent dirent; struct stat stat; int length; - - if (dfs_file_open(&fd, src, DFS_O_DIRECTORY) < 0) + struct dfs_fd cpfd; + if (dfs_file_open(&cpfd, src, DFS_O_DIRECTORY) < 0) { rt_kprintf("open %s failed\n", src); return ; @@ -665,7 +664,7 @@ static void copydir(const char * src, const char * dst) do { rt_memset(&dirent, 0, sizeof(struct dirent)); - length = dfs_file_getdents(&fd, &dirent, sizeof(struct dirent)); + length = dfs_file_getdents(&cpfd, &dirent, sizeof(struct dirent)); if (length > 0) { char * src_entry_full = RT_NULL; @@ -708,7 +707,7 @@ static void copydir(const char * src, const char * dst) } }while(length > 0); - dfs_file_close(&fd); + dfs_file_close(&cpfd); } static const char *_get_path_lastname(const char *path)