From b23d504796788536d66b523a2b5a3359691b3b2b Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 1 Jun 2013 04:04:25 +0200 Subject: [PATCH] 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. --- .../packagefs/nodes/UnpackingAttributeCookie.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingAttributeCookie.cpp b/src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingAttributeCookie.cpp index 867380f58c..e7488d696f 100644 --- a/src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingAttributeCookie.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingAttributeCookie.cpp @@ -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)