fat: fix setting wrong short file name having no extenstion
authorDonggeun Kim <dg77.kim@samsung.com>
Fri, 24 Dec 2010 04:45:02 +0000 (13:45 +0900)
committerDonggeun Kim <dg77.kim@samsung.com>
Fri, 24 Dec 2010 04:45:02 +0000 (13:45 +0900)
Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
fs/fat/fat_write.c

index ca1b1fb..bc6358c 100644 (file)
@@ -85,7 +85,7 @@ static void set_name (dir_entry *dirent, const char *filename)
 
        period = strchr(s_name, '.');
        if (period == NULL) {
-               period_location = len - 1;
+               period_location = len;
                ext_num = 0;
        } else {
                period_location = period - s_name;
@@ -108,7 +108,7 @@ static void set_name (dir_entry *dirent, const char *filename)
        if (ext_num < 3) {
                memcpy(dirent->ext, s_name + period_location + 1, ext_num);
                for (i = ext_num; i < 3; i++)
-                       dirent->name[i] = ' ';
+                       dirent->ext[i] = ' ';
        } else
                memcpy(dirent->ext, s_name + period_location + 1, 3);