Skip to content

Commit 3a8be27

Browse files
wdfk-progRbb666
authored andcommitted
fix:重复打开文件出错
1 parent 73b4fc1 commit 3a8be27

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

dfs_lfs.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,6 @@ static int _dfs_lfs_open(struct dfs_file* file)
576576
return -ENOENT;
577577
}
578578
file->pos = 0;
579-
return 0;
580579
}
581580

582581
dfs_lfs = (dfs_lfs_t*)dfs->data;
@@ -691,10 +690,6 @@ static int _dfs_lfs_close(struct dfs_file* file)
691690
RT_ASSERT(file->data != RT_NULL);
692691

693692
RT_ASSERT(file->vnode->ref_count > 0);
694-
if (file->vnode->ref_count > 1)
695-
{
696-
return 0;
697-
}
698693

699694
dfs_lfs_fd = (dfs_lfs_fd_t*)file->data;
700695

@@ -714,6 +709,7 @@ static int _dfs_lfs_close(struct dfs_file* file)
714709
}
715710

716711
rt_free(dfs_lfs_fd);
712+
file->data = RT_NULL;
717713

718714
return _lfs_result_to_dfs(result);
719715
}

0 commit comments

Comments
 (0)