2121 * Date           Author       Notes 
2222 * 2005-02-22     Bernard      The first version. 
2323 * 2011-12-08     Bernard      Merges rename patch from iamcacy. 
24+  * 2015-05-27     Bernard      Fix the fd clear issue. 
2425 */ 
2526
2627#include  <dfs.h> 
@@ -97,7 +98,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
9798    {
9899        /* clear fd */ 
99100        rt_free (fd -> path );
100-         rt_memset ( fd ,  0 ,  sizeof ( * fd )) ;
101+         fd -> path   =   RT_NULL ;
101102
102103        return  - DFS_STATUS_ENOSYS ;
103104    }
@@ -106,7 +107,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
106107    {
107108        /* clear fd */ 
108109        rt_free (fd -> path );
109-         rt_memset ( fd ,  0 ,  sizeof ( * fd )) ;
110+         fd -> path   =   RT_NULL ;
110111
111112        dfs_log (DFS_DEBUG_INFO , ("open failed" ));
112113
@@ -143,7 +144,7 @@ int dfs_file_close(struct dfs_fd *fd)
143144        return  result ;
144145
145146    rt_free (fd -> path );
146-     rt_memset ( fd ,  0 ,  sizeof ( struct   dfs_fd )) ;
147+     fd -> path   =   RT_NULL ;
147148
148149    return  result ;
149150}
@@ -165,7 +166,7 @@ int dfs_file_ioctl(struct dfs_fd *fd, int cmd, void *args)
165166        return  - DFS_STATUS_EINVAL ;
166167
167168    fs  =  fd -> fs ;
168-     if  (fs -> ops -> ioctl  !=  RT_NULL )  
169+     if  (fs -> ops -> ioctl  !=  RT_NULL )
169170        return  fs -> ops -> ioctl (fd , cmd , args );
170171
171172    return  - DFS_STATUS_ENOSYS ;
@@ -652,7 +653,6 @@ static void copyfile(const char *src, const char *dst)
652653extern  int  mkdir (const  char  * path , mode_t  mode );
653654static  void  copydir (const  char  *  src , const  char  *  dst )
654655{
655-     struct  dfs_fd  fd ;
656656    struct  dirent  dirent ;
657657    struct  stat  stat ;
658658    int  length ;
0 commit comments