summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/common/file.c7
-rw-r--r--firmware/drivers/fat.c4
2 files changed, 8 insertions, 3 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index f0437f9..613eba9 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -385,9 +385,6 @@ int rename(const char* path, const char* newpath)
return - 5;
file = &openfiles[fd];
-#ifdef HAVE_DIRCACHE
- dircache_rename(path, newpath);
-#endif
rc = fat_rename(&file->fatfile, &dir->fatdir, nameptr,
file->size, file->attr);
@@ -404,6 +401,10 @@ int rename(const char* path, const char* newpath)
return rc * 10 - 7;
}
+#ifdef HAVE_DIRCACHE
+ dircache_rename(path, newpath);
+#endif
+
rc = close(fd);
if (rc<0) {
errno = EIO;
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index dd0d4d6..9dd27cf 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -1202,6 +1202,10 @@ static int fat_checkname(const unsigned char* newname)
return -1;
newname++;
}
+ /* check trailing space(s) */
+ if(*(--newname) == ' ')
+ return -1;
+
return 0;
}