* Inode::OldSize() is the size of the file before the last index update

- this might be a bit older, so we cannot use it for the previous size
  in the call to Inode::FillGapWithZeros() in bfs_write_stat().
* This fixes the perl problem Ingo ran into after r24555.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24580 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-03-25 20:24:07 +00:00
parent cd31b326a3
commit 4893165400

View File

@ -729,13 +729,15 @@ bfs_write_stat(void *_ns, void *_node, const struct stat *stat, uint32 mask)
return B_IS_A_DIRECTORY;
if (inode->Size() != stat->st_size) {
off_t oldSize = inode->Size();
status = inode->SetFileSize(transaction, stat->st_size);
if (status < B_OK)
return status;
// fill the new blocks (if any) with zeros
if ((mask & B_STAT_SIZE_INSECURE) == 0)
inode->FillGapWithZeros(inode->OldSize(), inode->Size());
inode->FillGapWithZeros(oldSize, inode->Size());
if (!inode->IsDeleted()) {
Index index(volume);