From bae7c12dba9651705d21c73470da51bdc16f016d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 26 May 2005 02:05:44 +0000 Subject: [PATCH] bfs_read_link() did not report the correct link size (it did not take the terminating null byte into account) - thanks to Korli for reporting this. Inode::Create() will no longer publish symlink vnodes; instead, bfs_create_symlink() will publish the link when it is complete (ie. the actual link data had been written). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12822 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/Inode.cpp | 3 ++- src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/Inode.cpp b/src/add-ons/kernel/file_systems/bfs/Inode.cpp index aa4a951216..065d428d45 100644 --- a/src/add-ons/kernel/file_systems/bfs/Inode.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Inode.cpp @@ -123,7 +123,8 @@ InodeAllocator::Keep() return status; } - status = publish_vnode(volume->ID(), fInode->ID(), fInode); + if (!fInode->IsSymLink()) + status = publish_vnode(volume->ID(), fInode->ID(), fInode); fTransaction = NULL; fInode = NULL; diff --git a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp index d121229e34..6cbf8756ad 100644 --- a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp @@ -841,13 +841,12 @@ bfs_create_symlink(void *_ns, void *_directory, const char *name, const char *pa // we don't have to do that here... status = link->WriteAt(transaction, 0, (const uint8 *)path, &length); } - // ToDo: would be nice if Inode::Create() would wait with publish_vnode() - // until here, so that the link can be accessed directly if (status == B_OK) status = link->WriteBack(transaction); - // Inode::Create() left the inode locked in memory + // Inode::Create() left the inode locked in memory, and also doesn't publish links + publish_vnode(volume->ID(), id, link); put_vnode(volume->ID(), id); if (status == B_OK) { @@ -1344,7 +1343,7 @@ bfs_read_link(void *_ns, void *_node, char *buffer, size_t *_bufferSize) return B_OK; } - *_bufferSize = strlcpy(buffer, inode->Node().short_symlink, bufferSize); + *_bufferSize = strlcpy(buffer, inode->Node().short_symlink, bufferSize) + 1; if (*_bufferSize > bufferSize) return B_BUFFER_OVERFLOW;