diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-03-13 15:20:20 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-03-21 16:14:44 +0100 |
commit | c38f1fcf8f0fab90785b0aec4361d53673bbc864 (patch) | |
tree | 31ad825a1aa3e12afb966fcbdefd3be534da0c61 /cpukit/libfs/src/dosfs/fat.c | |
parent | dosfs: Fix msdos_utf8_normalize_and_fold() (diff) | |
download | rtems-c38f1fcf8f0fab90785b0aec4361d53673bbc864.tar.bz2 |
dosfs: Fix fat_file_write()
Remove forced overwrite which leads to file data corruption. The logic
to determine a forced overwrite was fundamentally broken. For simplity,
disable this feature.
Close #2622.
Diffstat (limited to 'cpukit/libfs/src/dosfs/fat.c')
-rw-r--r-- | cpukit/libfs/src/dosfs/fat.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c index 2176ff3496..a0475d4610 100644 --- a/cpukit/libfs/src/dosfs/fat.c +++ b/cpukit/libfs/src/dosfs/fat.c @@ -200,13 +200,12 @@ _fat_block_read( } static ssize_t - fat_block_write( +fat_block_write( fat_fs_info_t *fs_info, const uint32_t start_blk, const uint32_t offset, const uint32_t count, - const void *buf, - const bool overwrite_block) + const void *buf) { int rc = RC_OK; uint32_t bytes_to_write = MIN(count, (fs_info->vol.bytes_per_block - offset)); @@ -215,8 +214,7 @@ static ssize_t if (0 < bytes_to_write) { - if ( overwrite_block - || (bytes_to_write == fs_info->vol.bytes_per_block)) + if (bytes_to_write == fs_info->vol.bytes_per_block) { rc = fat_buf_access(fs_info, sec_num, FAT_OP_TYPE_GET, &blk_buf); } @@ -399,7 +397,6 @@ _fat_block_release(fat_fs_info_t *fs_info) * offset - offset inside cluster 'start' * count - count of bytes to write * buff - buffer provided by user - * overwrite_cluster - true if cluster can get overwritten, false if cluster content must be kept * * RETURNS: * bytes written on success, or -1 if error occured @@ -411,8 +408,7 @@ fat_cluster_write( const uint32_t start_cln, const uint32_t offset, const uint32_t count, - const void *buff, - const bool overwrite_cluster) + const void *buff) { ssize_t rc = RC_OK; uint32_t bytes_to_write = MIN(count, (fs_info->vol.bpc - offset)); @@ -436,8 +432,7 @@ fat_cluster_write( cur_blk, ofs_blk, c, - &buffer[bytes_written], - overwrite_cluster); + &buffer[bytes_written]); if (c != ret) rc = -1; else |