summaryrefslogtreecommitdiff
path: root/firmware/drivers/fat.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r--firmware/drivers/fat.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 1b530153a5..e41bbaca41 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -1551,12 +1551,13 @@ int fat_remove(struct fat_file* file)
1551} 1551}
1552 1552
1553int fat_rename(struct fat_file* file, 1553int fat_rename(struct fat_file* file,
1554 const unsigned char* newname, 1554 struct fat_dir* dir,
1555 int size, 1555 const unsigned char* newname,
1556 int attr) 1556 int size,
1557 int attr)
1557{ 1558{
1558 int rc; 1559 int rc;
1559 struct fat_dir dir; 1560 struct fat_dir olddir;
1560 struct fat_file newfile = *file; 1561 struct fat_file newfile = *file;
1561 1562
1562 if ( !file->dircluster ) { 1563 if ( !file->dircluster ) {
@@ -1565,12 +1566,12 @@ int fat_rename(struct fat_file* file,
1565 } 1566 }
1566 1567
1567 /* create a temporary file handle */ 1568 /* create a temporary file handle */
1568 rc = fat_opendir(&dir, file->dircluster, NULL); 1569 rc = fat_opendir(&olddir, file->dircluster, NULL);
1569 if (rc < 0) 1570 if (rc < 0)
1570 return rc * 10 - 2; 1571 return rc * 10 - 2;
1571 1572
1572 /* create new name */ 1573 /* create new name */
1573 rc = add_dir_entry(&dir, &newfile, newname, false, false); 1574 rc = add_dir_entry(dir, &newfile, newname, false, false);
1574 if (rc < 0) 1575 if (rc < 0)
1575 return rc * 10 - 3; 1576 return rc * 10 - 3;
1576 1577