Add already opened file logic

This commit is contained in:
li_zan 2021-05-07 11:35:51 +08:00
parent a99f817c23
commit cd292f8428
1 changed files with 3 additions and 3 deletions

View File

@ -64,9 +64,9 @@ LittleFsHandleStruct *GetFreeFd(int *fd)
bool CheckFileIsOpen(const char *fileName, int *fd)
{
for(int i = 0; i < LITTLE_FS_MAX_OPEN_FILES; i++) {
if(g_handle[i].useFlag == 1) {
if(strcmp(g_handle[i].pathName, fileName) == 0) {
for (int i = 0; i < LITTLE_FS_MAX_OPEN_FILES; i++) {
if (g_handle[i].useFlag == 1) {
if (strcmp(g_handle[i].pathName, fileName) == 0) {
*fd = i;
return true;
}