* Fixed bug #2727: symlinks usually "abuse" the data stream part of a

bfs_inode to store the link path (up to a certain length). If this was long
  enough to clobber the data_stream::size field (which luckily was the last
  field of struct data_stream), Inode::Free() would mistakenly assume this to
  be a valid data stream to be freed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28311 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-24 10:36:43 +00:00
parent 0982317bea
commit 528b69d508
@@ -2151,9 +2151,11 @@ Inode::Free(Transaction& transaction)
// Perhaps there should be an implementation of Inode::ShrinkStream() that
// just frees the data_stream, but doesn't change the inode (since it is
// freed anyway) - that would make an undelete command possible
status_t status = SetFileSize(transaction, 0);
if (status < B_OK)
return status;
if (!IsSymLink() || (Flags() & INODE_LONG_SYMLINK) != 0) {
status_t status = SetFileSize(transaction, 0);
if (status < B_OK)
return status;
}
// Free all attributes, and remove their indices
{
@@ -2165,7 +2167,7 @@ Inode::Free(Transaction& transaction)
uint32 type;
size_t length;
ino_t id;
while ((status = iterator.GetNext(name, &length, &type, &id)) == B_OK) {
while (iterator.GetNext(name, &length, &type, &id) == B_OK) {
RemoveAttribute(transaction, name);
}
}