]> git.sur5r.net Git - u-boot/commitdiff
fat write: Fixed a problem with the case of file names when writing files
authorJean-Jacques Hiblot <jjhiblot@ti.com>
Thu, 21 Dec 2017 11:49:47 +0000 (12:49 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 10 Jan 2018 13:05:51 +0000 (08:05 -0500)
commit 21a24c3bf35b ("fs/fat: fix case for FAT shortnames") made it
possible that get_name() returns file names with some upper cases.
find_directory_entry() must be updated to take this account, and use
case-insensitive functions to compare file names.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
fs/fat/fat_write.c

index 9d2e0ed74c8c7ced6e42759c5f0e39de5349d828..cd65192da54771e815ef0a3b58282d6f8b9d18e5 100644 (file)
@@ -842,8 +842,8 @@ static dir_entry *find_directory_entry(fsdata *mydata, int startsect,
 
                        get_name(dentptr, s_name);
 
-                       if (strcmp(filename, s_name)
-                           && strcmp(filename, l_name)) {
+                       if (strncasecmp(filename, s_name, sizeof(s_name)) &&
+                           strncasecmp(filename, l_name, sizeof(l_name))) {
                                debug("Mismatch: |%s|%s|\n",
                                        s_name, l_name);
                                dentptr++;