summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/dosfs/fat_file.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-06-03 13:06:51 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-06-04 09:54:32 +0200
commit96b1d7fcfeb268b9803bc3f17ceb2653f0109a2d (patch)
tree9520255d5b5a2b46bcfb536711e641c84bdb0eca /cpukit/libfs/src/dosfs/fat_file.c
parentlibblock: Add read-ahead task (diff)
downloadrtems-96b1d7fcfeb268b9803bc3f17ceb2653f0109a2d.tar.bz2
dosfs: Fix for no space left on device condition
The file size was wrong in the no space left on device condition. This resulted in turn in a read of an invalid block which lead to an EIO error status.
Diffstat (limited to 'cpukit/libfs/src/dosfs/fat_file.c')
-rw-r--r--cpukit/libfs/src/dosfs/fat_file.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpukit/libfs/src/dosfs/fat_file.c b/cpukit/libfs/src/dosfs/fat_file.c
index b6a466e265..88f8e5b571 100644
--- a/cpukit/libfs/src/dosfs/fat_file.c
+++ b/cpukit/libfs/src/dosfs/fat_file.c
@@ -552,9 +552,10 @@ fat_file_extend(
/* check wether we satisfied request for 'cls2add' clusters */
if (cls2add != cls_added)
- *a_length = new_length -
- ((cls2add - cls_added - 1) << fs_info->vol.bpc_log2) -
- (bytes2add & (fs_info->vol.bpc - 1));
+ {
+ new_length -= bytes2add & (fs_info->vol.bpc - 1);
+ new_length -= (cls2add - cls_added) << fs_info->vol.bpc_log2;
+ }
/* add new chain to the end of existed */
if ( fat_fd->fat_file_size == 0 )
@@ -603,6 +604,7 @@ fat_file_extend(
}
}
+ *a_length = new_length;
fat_fd->fat_file_size = new_length;
return RC_OK;