Add already opened file logic

This commit is contained in:
li_zan
2021-05-08 11:14:33 +08:00
parent 94c0727e1d
commit 49e9044529

View File

@@ -246,7 +246,7 @@ int LfsOpen(const char *pathName, int openFlag, int mode)
}
return fd;
errout:
errout:
return INVALID_FD;
}
@@ -287,6 +287,9 @@ int LfsClose(int fd)
ret = lfs_file_close(&g_lfs, &(g_handle[fd].file));
pthread_mutex_lock(&g_FslocalMutex);
g_handle[fd].useFlag = 0;
if (g_handle[fd].pathName != NULL) {
free(g_handle[fd].pathName);
}
pthread_mutex_unlock(&g_FslocalMutex);