packagefs: UnpackingAttributeCookie: Open package

... when reading non-inline attribute data. Generally the package should
already have been opened by the PackageNode owning the attribute (in
InitVFS()), but that isn't the case for queries, which can read
attributes from entirely unsuspecting nodes.

Together with the QueryParser fix that should fix queries involving
non-indexed attributes.
This commit is contained in:
Ingo Weinhold 2013-06-01 04:04:25 +02:00
parent 10e9f49914
commit b23d504796
1 changed files with 7 additions and 1 deletions

View File

@ -128,8 +128,14 @@ UnpackingAttributeCookie::ReadAttribute(PackageNode* packageNode,
return read_package_data(data, &dataReader, offset, buffer, bufferSize);
}
// data not inline -- let the package create a data reader for us
// data not inline -- open the package and let it create a data reader for
// us
Package* package = packageNode->GetPackage();
int fd = package->Open();
if (fd < 0)
RETURN_ERROR(fd);
PackageCloser packageCloser(package);
BAbstractBufferedDataReader* reader;
status_t error = package->CreateDataReader(data, reader);
if (error != B_OK)