R0.10c with patch 1

November 13, 2014

f_unlink function does not remove cluster chain of the file. It reads to
a lost cluster of the FAT volume. This is added at a bugfix of R0.10c.
This commit is contained in:
Christopher Williams
2015-01-31 09:43:19 -07:00
parent 0e89a5798f
commit f253f45166
+3 -1
View File
@@ -3486,8 +3486,9 @@ FRESULT f_unlink (
if (dir[DIR_Attr] & AM_RDO)
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);
if (dir[DIR_Attr] & AM_DIR) { /* Is it a sub-dir? */
if (!dclst) {
res = FR_INT_ERR;
} else { /* Make sure the sub-directory is empty */
@@ -3505,6 +3506,7 @@ FRESULT f_unlink (
}
}
}
}
if (res == FR_OK) {
res = dir_remove(&dj); /* Remove the directory entry */
if (res == FR_OK && dclst) /* Remove the cluster chain if exist */