[rtems commit] dosfs: Fix file length update
Sebastian Huber
sebh at rtems.org
Wed Feb 20 08:21:08 UTC 2013
Module: rtems
Branch: master
Commit: 78a50d924c8c0a540e0d3ab60579de516e560c95
Changeset: http://git.rtems.org/rtems/commit/?id=78a50d924c8c0a540e0d3ab60579de516e560c95
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Feb 18 08:36:55 2013 +0100
dosfs: Fix file length update
---
cpukit/libfs/src/dosfs/fat_file.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/cpukit/libfs/src/dosfs/fat_file.c b/cpukit/libfs/src/dosfs/fat_file.c
index b71745f..4425b85 100644
--- a/cpukit/libfs/src/dosfs/fat_file.c
+++ b/cpukit/libfs/src/dosfs/fat_file.c
@@ -633,8 +633,9 @@ fat_file_extend(
/* check wether we satisfied request for 'cls2add' clusters */
if (cls2add != cls_added)
{
- new_length -= bytes2add & (fs_info->vol.bpc - 1);
- new_length -= (cls2add - cls_added) << fs_info->vol.bpc_log2;
+ uint32_t missing = (cls2add - cls_added) << fs_info->vol.bpc_log2;
+
+ new_length -= bytes2add < missing ? bytes2add : missing;
}
if (cls_added > 0)
More information about the vc
mailing list