Fix a critical bug with exFAT FatFs + a list bug
Nintendo you hear? Fix your driver already. (for us never caused any problem, because we always sync fs dir changes to medium.)
This commit is contained in:
@@ -4943,6 +4943,7 @@ FRESULT f_mkdir (
|
||||
{
|
||||
FRESULT res;
|
||||
DIR dj;
|
||||
FFOBJID sobj;
|
||||
FATFS *fs;
|
||||
BYTE *dir;
|
||||
DWORD dcl, pcl, tm;
|
||||
@@ -4960,8 +4961,8 @@ FRESULT f_mkdir (
|
||||
res = FR_INVALID_NAME;
|
||||
}
|
||||
if (res == FR_NO_FILE) { /* Can create a new directory */
|
||||
dcl = create_chain(&dj.obj, 0); /* Allocate a cluster for the new directory table */
|
||||
dj.obj.objsize = (DWORD)fs->csize * SS(fs);
|
||||
sobj.fs = fs; /* New object id to create a new chain */
|
||||
dcl = create_chain(&sobj, 0); /* Allocate a cluster for the new directory */
|
||||
res = FR_OK;
|
||||
if (dcl == 0) res = FR_DENIED; /* No space to allocate a new cluster */
|
||||
if (dcl == 1) res = FR_INT_ERR;
|
||||
@@ -4991,8 +4992,8 @@ FRESULT f_mkdir (
|
||||
if (fs->fs_type == FS_EXFAT) { /* Initialize directory entry block */
|
||||
st_dword(fs->dirbuf + XDIR_ModTime, tm); /* Created time */
|
||||
st_dword(fs->dirbuf + XDIR_FstClus, dcl); /* Table start cluster */
|
||||
st_dword(fs->dirbuf + XDIR_FileSize, (DWORD)dj.obj.objsize); /* File size needs to be valid */
|
||||
st_dword(fs->dirbuf + XDIR_ValidFileSize, (DWORD)dj.obj.objsize);
|
||||
st_dword(fs->dirbuf + XDIR_FileSize, (DWORD)fs->csize * SS(fs)); /* File size needs to be valid */
|
||||
st_dword(fs->dirbuf + XDIR_ValidFileSize, (DWORD)fs->csize * SS(fs));
|
||||
fs->dirbuf[XDIR_GenFlags] = 3; /* Initialize the object flag */
|
||||
fs->dirbuf[XDIR_Attr] = AM_DIR; /* Attribute */
|
||||
res = store_xdir(&dj);
|
||||
|
||||
Reference in New Issue
Block a user