summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-02-27 10:40:49 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-02-28 09:50:53 +0100
commit6ec60de37d899646552f988d974017d5f54c4e3c (patch)
treedcbda208851949389ddd48079d8d00fad9075e8f
parentRemove old CVS keywords (diff)
downloadrtems-6ec60de37d899646552f988d974017d5f54c4e3c.tar.bz2
dosfs: Directories should have a file size of 0
Update #2755.
-rw-r--r--cpukit/libfs/src/dosfs/msdos_misc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpukit/libfs/src/dosfs/msdos_misc.c b/cpukit/libfs/src/dosfs/msdos_misc.c
index 39f6ca28a4..c854d4882d 100644
--- a/cpukit/libfs/src/dosfs/msdos_misc.c
+++ b/cpukit/libfs/src/dosfs/msdos_misc.c
@@ -820,7 +820,12 @@ fat_file_write_file_size(
sec += (fat_fd->dir_pos.sname.ofs >> fs_info->vol.sec_log2);
byte = (fat_fd->dir_pos.sname.ofs & (fs_info->vol.bps - 1));
- le_new_length = CT_LE_L((fat_fd->fat_file_size));
+ if (fat_fd->fat_file_type == FAT_DIRECTORY) {
+ le_new_length = CT_LE_L(0);
+ } else {
+ le_new_length = CT_LE_L(fat_fd->fat_file_size);
+ }
+
ret = fat_sector_write(fs_info, sec, byte + MSDOS_FILE_SIZE_OFFSET, 4,
(char *)(&le_new_length));
if ( ret < 0 )