diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-11-24 21:04:07 +0100 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-12-10 09:14:58 +0100 |
commit | c5924118c03dc8db30d633de98afe6ad6eb7f277 (patch) | |
tree | 36f5e0411cab19ffdfeb13e4cd221cc3cef49f42 /fs | |
parent | 03f1f78a9b44b5fd6fc09faf81639879d2d0f85f (diff) | |
download | u-boot-c5924118c03dc8db30d633de98afe6ad6eb7f277.tar.gz |
fs: fat: correct first cluster for '..'
The FAT specification [1] requires that for a '..' directory entry pointing
to the root directory the fields DIR_FstClusHi and DIR_FstClusLo are 0.
[1] Microsoft FAT Specification, Microsoft Corporation, August 30 2005
Fixes: 31a18d570d96 ("fs: fat: support mkdir")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fat/fat_write.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 7afc8388b2..4da342f9c9 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -1468,7 +1468,11 @@ int fat_mkdir(const char *new_dirname) memcpy(dotdent[1].name, ".. ", 8); memcpy(dotdent[1].ext, " ", 3); dotdent[1].attr = ATTR_DIR | ATTR_ARCH; - set_start_cluster(mydata, &dotdent[1], itr->start_clust); + + if (itr->is_root) + set_start_cluster(mydata, &dotdent[1], 0); + else + set_start_cluster(mydata, &dotdent[1], itr->start_clust); ret = set_contents(mydata, retdent, 0, (__u8 *)dotdent, bytesperclust, &actwrite); |