Let the FAT namecheck also look for trailing spaces, fixes FS #8560.

Only call the dircache rename function if the actual rename was ok.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16241 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Peter D'Hoye 2008-02-07 22:15:13 +00:00
parent 1b39f2e117
commit c04f497670
2 changed files with 8 additions and 3 deletions

View file

@ -385,9 +385,6 @@ int rename(const char* path, const char* newpath)
return - 5; return - 5;
file = &openfiles[fd]; file = &openfiles[fd];
#ifdef HAVE_DIRCACHE
dircache_rename(path, newpath);
#endif
rc = fat_rename(&file->fatfile, &dir->fatdir, nameptr, rc = fat_rename(&file->fatfile, &dir->fatdir, nameptr,
file->size, file->attr); file->size, file->attr);
@ -404,6 +401,10 @@ int rename(const char* path, const char* newpath)
return rc * 10 - 7; return rc * 10 - 7;
} }
#ifdef HAVE_DIRCACHE
dircache_rename(path, newpath);
#endif
rc = close(fd); rc = close(fd);
if (rc<0) { if (rc<0) {
errno = EIO; errno = EIO;

View file

@ -1202,6 +1202,10 @@ static int fat_checkname(const unsigned char* newname)
return -1; return -1;
newname++; newname++;
} }
/* check trailing space(s) */
if(*(--newname) == ' ')
return -1;
return 0; return 0;
} }