diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2005-01-04 23:20:02 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2005-01-04 23:20:02 +0000 |
| commit | 93660701e633547dedcd1099501f2ac6d7f44fee (patch) | |
| tree | 9058ba3e7bc15975ef063b5bbcdc93e3a386da54 | |
| parent | 50dba1fad0a3d83c3ee803b398b4969109bd70c1 (diff) | |
| download | rockbox-93660701e633547dedcd1099501f2ac6d7f44fee.zip rockbox-93660701e633547dedcd1099501f2ac6d7f44fee.tar.gz rockbox-93660701e633547dedcd1099501f2ac6d7f44fee.tar.bz2 rockbox-93660701e633547dedcd1099501f2ac6d7f44fee.tar.xz | |
Multivolume: prevent file rename attempts across volumes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5535 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/drivers/fat.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index b3f6891..85bd525 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -1835,36 +1835,41 @@ int fat_rename(struct fat_file* file, struct fat_file newfile = *file; #ifdef HAVE_MULTIVOLUME struct bpb* fat_bpb = &fat_bpbs[file->volume]; + + if (file->volume != dir->file.volume) { + DEBUGF("No rename across volumes!\n"); + return -1; + } #endif if ( !file->dircluster ) { DEBUGF("File has no dir cluster!\n"); - return -1; + return -2; } /* create a temporary file handle */ rc = fat_opendir(IF_MV2(file->volume,) &olddir, file->dircluster, NULL); if (rc < 0) - return rc * 10 - 2; + return rc * 10 - 3; /* create new name */ rc = add_dir_entry(dir, &newfile, newname, false, false); if (rc < 0) - return rc * 10 - 3; + return rc * 10 - 4; /* write size and cluster link */ rc = update_short_entry(&newfile, size, attr); if (rc < 0) - return rc * 10 - 4; + return rc * 10 - 5; /* remove old name */ rc = free_direntries(file); if (rc < 0) - return rc * 10 - 5; + return rc * 10 - 6; rc = flush_fat(IF_MV(fat_bpb)); if (rc < 0) - return rc * 10 - 6; + return rc * 10 - 7; return 0; } |