* Fixed the bug Bruno observed (and worked around) in a safer way - the node data was
not written back before GetNextSmallData() was called (which let the region appear empty even though it wasn't). * I left the shortcut in case of the "name" attribute in there, because it should be a bit faster. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18949 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -699,7 +699,8 @@ Inode::Name(const bfs_inode *node) const
|
||||
|
||||
small_data *smallData = NULL;
|
||||
while (GetNextSmallData((bfs_inode *)node, &smallData) == B_OK) {
|
||||
if (*smallData->Name() == FILE_NAME_NAME && smallData->NameSize() == FILE_NAME_NAME_LENGTH)
|
||||
if (*smallData->Name() == FILE_NAME_NAME
|
||||
&& smallData->NameSize() == FILE_NAME_NAME_LENGTH)
|
||||
return (const char *)smallData->Data();
|
||||
}
|
||||
return NULL;
|
||||
@@ -2227,6 +2228,9 @@ Inode::Create(Transaction &transaction, Inode *parent, const char *name, int32 m
|
||||
|
||||
node->type = HOST_ENDIAN_TO_BFS_INT32(type);
|
||||
|
||||
inode->WriteBack(transaction);
|
||||
// make sure the initialized node is available to others
|
||||
|
||||
// only add the name to regular files, directories, or symlinks
|
||||
// don't add it to attributes, or indices
|
||||
if (tree && inode->IsRegularNode() && inode->SetName(transaction, name) < B_OK)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* by J. Kercheval, and on code written by Kenneth Almquist, though
|
||||
* it shares no code.
|
||||
*
|
||||
* Copyright 2001-2005, Axel Dörfler, [email protected].
|
||||
* Copyright 2001-2006, Axel Dörfler, [email protected].
|
||||
* This file may be used under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@@ -1600,24 +1600,13 @@ Query::LiveUpdate(Inode *inode, const char *attribute, int32 type, const uint8 *
|
||||
char nameBuffer[B_FILE_NAME_LENGTH];
|
||||
|
||||
if (name == NULL) {
|
||||
|
||||
// We have to special-case the name attribute here because
|
||||
// Inode::Getname will return NULL as we are in the middle
|
||||
// of the transaction at this point when a new file is
|
||||
// created. We just use newKey which happens to contain
|
||||
// the new file name anyway.
|
||||
//
|
||||
// TODO: Check if there is any sense in leaving this if
|
||||
// statement as it is or if we can completelly remove the
|
||||
// original code.
|
||||
if (strcmp(attribute, "name") == 0) {
|
||||
name = (const char *)newKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(attribute, "name")) {
|
||||
if (inode->GetName(nameBuffer) != B_OK)
|
||||
nameBuffer[0] = '\0';
|
||||
name = nameBuffer;
|
||||
} else {
|
||||
// a shortcut to prevent having to scan the attribute section
|
||||
name = (const char *)newKey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user