* Fill the gap between a write and the former file size with zeros, too.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36263 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b26f67513b
commit
f3cf9af6bf
@ -1565,7 +1565,9 @@ Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer,
|
||||
writeLocker.Lock();
|
||||
}
|
||||
|
||||
if (pos + length > Size()) {
|
||||
off_t oldSize = Size();
|
||||
|
||||
if (pos + length > oldSize) {
|
||||
// let's grow the data stream to the size needed
|
||||
status_t status = SetFileSize(transaction, pos + length);
|
||||
if (status != B_OK) {
|
||||
@ -1589,6 +1591,9 @@ Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer,
|
||||
|
||||
writeLocker.Unlock();
|
||||
|
||||
if (oldSize < pos)
|
||||
FillGapWithZeros(oldSize, pos);
|
||||
|
||||
// If we don't want to write anything, we can now return (we may
|
||||
// just have changed the file size using the position parameter)
|
||||
if (length == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user