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:
@@ -3486,22 +3486,24 @@ 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 (!dclst) {
|
||||
res = FR_INT_ERR;
|
||||
} else { /* Make sure the sub-directory is empty */
|
||||
mem_cpy(&sdj, &dj, sizeof (DIR));
|
||||
sdj.sclust = dclst;
|
||||
res = dir_sdi(&sdj, 2); /* Exclude dot entries */
|
||||
if (res == FR_OK) {
|
||||
res = dir_read(&sdj, 0); /* Read an item */
|
||||
if (res == FR_OK /* Not empty directory */
|
||||
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 */
|
||||
mem_cpy(&sdj, &dj, sizeof (DIR));
|
||||
sdj.sclust = dclst;
|
||||
res = dir_sdi(&sdj, 2); /* Exclude dot entries */
|
||||
if (res == FR_OK) {
|
||||
res = dir_read(&sdj, 0); /* Read an item */
|
||||
if (res == FR_OK /* Not empty directory */
|
||||
#if _FS_RPATH
|
||||
|| dclst == dj.fs->cdir /* or current directory */
|
||||
|| dclst == dj.fs->cdir /* or current directory */
|
||||
#endif
|
||||
) res = FR_DENIED;
|
||||
if (res == FR_NO_FILE) res = FR_OK; /* It is empty */
|
||||
) res = FR_DENIED;
|
||||
if (res == FR_NO_FILE) res = FR_OK; /* It is empty */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user