浏览代码

Merge pull request #549 from www220/fix

[DFS] fix the fd_put issue in mkdir and lseek error case.
Bernard Xiong 9 年之前
父节点
当前提交
811a2ead68
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      components/dfs/src/dfs_posix.c

+ 4 - 0
components/dfs/src/dfs_posix.c

@@ -230,6 +230,7 @@ off_t lseek(int fd, off_t offset, int whence)
         break;
 
     default:
+        fd_put(d);
         rt_set_errno(-DFS_STATUS_EINVAL);
 
         return -1;
@@ -237,6 +238,7 @@ off_t lseek(int fd, off_t offset, int whence)
 
     if (offset < 0)
     {
+        fd_put(d);
         rt_set_errno(-DFS_STATUS_EINVAL);
 
         return -1;
@@ -457,6 +459,7 @@ int mkdir(const char *path, mode_t mode)
 
     if (result < 0)
     {
+        fd_put(d);
         fd_put(d);
         rt_set_errno(result);
 
@@ -465,6 +468,7 @@ int mkdir(const char *path, mode_t mode)
 
     dfs_file_close(d);
     fd_put(d);
+    fd_put(d);
 
     return 0;
 }