summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-08-22 11:28:24 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-08-22 11:28:24 +0000
commite0e0140f4e63b451a110840dc5ef5c22c3ed9f7c (patch)
tree6e48d6ddc4609f9a49eb2913b145b8d1f81e5436 /firmware/drivers
parent1a6a4812aa46d66ca46e308897e0cf759e42773f (diff)
downloadrockbox-e0e0140f4e63b451a110840dc5ef5c22c3ed9f7c.zip
rockbox-e0e0140f4e63b451a110840dc5ef5c22c3ed9f7c.tar.gz
rockbox-e0e0140f4e63b451a110840dc5ef5c22c3ed9f7c.tar.bz2
rockbox-e0e0140f4e63b451a110840dc5ef5c22c3ed9f7c.tar.xz
Bug fix: renaming a directory could cause a name clash. New feature: rename() can now move files/directories as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5008 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-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 1b53015..e41bbac 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -1551,12 +1551,13 @@ int fat_remove(struct fat_file* file)
}
int fat_rename(struct fat_file* file,
- const unsigned char* newname,
- int size,
- int attr)
+ struct fat_dir* dir,
+ const unsigned char* newname,
+ int size,
+ int attr)
{
int rc;
- struct fat_dir dir;
+ struct fat_dir olddir;
struct fat_file newfile = *file;
if ( !file->dircluster ) {
@@ -1565,12 +1566,12 @@ int fat_rename(struct fat_file* file,
}
/* create a temporary file handle */
- rc = fat_opendir(&dir, file->dircluster, NULL);
+ rc = fat_opendir(&olddir, file->dircluster, NULL);
if (rc < 0)
return rc * 10 - 2;
/* create new name */
- rc = add_dir_entry(&dir, &newfile, newname, false, false);
+ rc = add_dir_entry(dir, &newfile, newname, false, false);
if (rc < 0)
return rc * 10 - 3;