From bd5bd2c61e4d3339933ace510382db0f89e57689 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 27 Sep 2008 19:11:40 +0000 Subject: [PATCH] Normalize() didn't update fPathLength correctly. This did probably screw up module image paths in module_init_post_boot_device(). Not sure whether it also could cause #2776. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27760 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/fs/KPath.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/fs/KPath.cpp b/src/system/kernel/fs/KPath.cpp index fc84ff7693..a7c55e31f6 100644 --- a/src/system/kernel/fs/KPath.cpp +++ b/src/system/kernel/fs/KPath.cpp @@ -293,8 +293,18 @@ KPath::Normalize(bool traverseLeafLink) if (fPathLength == 0) return B_BAD_VALUE; - return vfs_normalize_path(fBuffer, fBuffer, fBufferSize, traverseLeafLink, + status_t error = vfs_normalize_path(fBuffer, fBuffer, fBufferSize, + traverseLeafLink, team_get_kernel_team_id() == team_get_current_team_id()); + if (error != B_OK) { + // vfs_normalize_path() might have screwed up the previous path -- unset + // it completely to avoid weird problems. + fBuffer[0] = '\0'; + fPathLength = 0; + } + + fPathLength = strlen(fBuffer); + return B_OK; }