Fixes #2027: Deleting file on radio does not actually frees clusters (patch from upstream)
This commit is contained in:
@@ -163,8 +163,11 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Timestamp feature */
|
/* Timestamp feature */
|
||||||
#if _FS_NORTC
|
#if _FS_NORTC == 1
|
||||||
#define GET_FATTIME() ((DWORD)_NORTC_YEAR << 25 | (DWORD)_NORTC_MON << 21 | (DWORD)_NORTC_MDAY << 16)
|
#if _NORTC_YEAR < 1980 || _NORTC_YEAR > 2107 || _NORTC_MON < 1 || _NORTC_MON > 12 || _NORTC_MDAY < 1 || _NORTC_MDAY > 31
|
||||||
|
#error Invalid _FS_NORTC settings
|
||||||
|
#endif
|
||||||
|
#define GET_FATTIME() ((DWORD)(_NORTC_YEAR - 1980) << 25 | (DWORD)_NORTC_MON << 21 | (DWORD)_NORTC_MDAY << 16)
|
||||||
#else
|
#else
|
||||||
#define GET_FATTIME() get_fattime()
|
#define GET_FATTIME() get_fattime()
|
||||||
#endif
|
#endif
|
||||||
@@ -3496,8 +3499,9 @@ FRESULT f_unlink (
|
|||||||
if (dir[DIR_Attr] & AM_RDO)
|
if (dir[DIR_Attr] & AM_RDO)
|
||||||
res = FR_DENIED; /* Cannot remove R/O object */
|
res = FR_DENIED; /* Cannot remove R/O object */
|
||||||
}
|
}
|
||||||
if (res == FR_OK && (dir[DIR_Attr] & AM_DIR)) { /* Is it a sub-dir? */
|
if (res == FR_OK) {
|
||||||
dclst = ld_clust(dj.fs, dir);
|
dclst = ld_clust(dj.fs, dir);
|
||||||
|
if (dir[DIR_Attr] & AM_DIR) { /* Is it a sub-dir? */
|
||||||
if (!dclst) {
|
if (!dclst) {
|
||||||
res = FR_INT_ERR;
|
res = FR_INT_ERR;
|
||||||
} else { /* Make sure the sub-directory is empty */
|
} else { /* Make sure the sub-directory is empty */
|
||||||
@@ -3515,6 +3519,7 @@ FRESULT f_unlink (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (res == FR_OK) {
|
if (res == FR_OK) {
|
||||||
res = dir_remove(&dj); /* Remove the directory entry */
|
res = dir_remove(&dj); /* Remove the directory entry */
|
||||||
if (res == FR_OK && dclst) /* Remove the cluster chain if exist */
|
if (res == FR_OK && dclst) /* Remove the cluster chain if exist */
|
||||||
|
|||||||
Reference in New Issue
Block a user