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.
This commit is contained in:
Ingo Weinhold
2013-06-07 02:01:46 +02:00
parent a266b57a9a
commit 280b7cb63a
+12
View File
@@ -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<SymlinkDescriptor*>(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);