summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2006-03-02 11:03:34 +0000
committerDan Everton <dan@iocaine.org>2006-03-02 11:03:34 +0000
commitccd0e7451dddcf5b3480364fa48ffc296a87e61d (patch)
tree006480d1a4b74d94ca3cc8c32252ac3c6465f1bc
parentb621de368b1fbfe5dd0989a9e37bf4abf9a40541 (diff)
downloadrockbox-ccd0e7451dddcf5b3480364fa48ffc296a87e61d.tar.gz
rockbox-ccd0e7451dddcf5b3480364fa48ffc296a87e61d.zip
Change rename() to set errno to EXDEV if a rename is attempted across volumes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8883 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/common/file.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index 90fab6db99..f37fb0ae7f 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -340,10 +340,17 @@ int rename(const char* path, const char* newpath)
file = &openfiles[fd];
rc = fat_rename(&file->fatfile, &dir->fatdir, nameptr,
file->size, file->attr);
+#ifdef HAVE_MULTIVOLUME
+ if ( rc == -1) {
+ DEBUGF("Failed renaming file across volumnes: %d\n", rc);
+ errno = EXDEV;
+ return -6;
+ }
+#endif
if ( rc < 0 ) {
DEBUGF("Failed renaming file: %d\n", rc);
errno = EIO;
- return rc * 10 - 6;
+ return rc * 10 - 7;
}
#ifdef HAVE_DIRCACHE
@@ -353,13 +360,13 @@ int rename(const char* path, const char* newpath)
rc = close(fd);
if (rc<0) {
errno = EIO;
- return rc * 10 - 7;
+ return rc * 10 - 8;
}
rc = closedir(dir);
if (rc<0) {
errno = EIO;
- return rc * 10 - 8;
+ return rc * 10 - 9;
}
return 0;