From 280b7cb63abaa3f6132a37a3ce7ad994f2ec7b52 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 7 Jun 2013 02:01:46 +0200 Subject: [PATCH] libroot_build: Improve/fix get_path() In fs_attr_generic() get_path() is used with a symlink FD, which didn't work at all. Handle symlink descriptors explicitly now. --- src/build/libroot/fs.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/build/libroot/fs.cpp b/src/build/libroot/fs.cpp index 5a9ebdfb09..d15aca0053 100644 --- a/src/build/libroot/fs.cpp +++ b/src/build/libroot/fs.cpp @@ -411,6 +411,18 @@ BPrivate::get_path(int fd, const char *name, string &path) if (!descriptor) return B_FILE_ERROR; + // Handle symlink descriptors here explicitly, so this function can be + // used more flexibly. + if (SymlinkDescriptor* symlinkDescriptor + = dynamic_cast(descriptor)) { + path = symlinkDescriptor->path; + if (name == NULL) + return B_OK; + path += '/'; + path += name; + return B_OK; + } + // get node ref for the descriptor NodeRef ref; status_t error = descriptor->GetNodeRef(ref);