* The DeviceOpener class was leaking its block cache; RemoveCache()
would never do anything as fBlockCache was never set. * DeviceOpener::InitCache() did not always correctly propagate the read-only flag. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24572 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -74,7 +74,7 @@ DeviceOpener::DeviceOpener(int fd, int mode)
|
|||||||
|
|
||||||
DeviceOpener::~DeviceOpener()
|
DeviceOpener::~DeviceOpener()
|
||||||
{
|
{
|
||||||
if (fDevice >= B_OK) {
|
if (fDevice >= 0) {
|
||||||
RemoveCache(false);
|
RemoveCache(false);
|
||||||
close(fDevice);
|
close(fDevice);
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,8 @@ DeviceOpener::Open(int fd, int mode)
|
|||||||
void *
|
void *
|
||||||
DeviceOpener::InitCache(off_t numBlocks, uint32 blockSize)
|
DeviceOpener::InitCache(off_t numBlocks, uint32 blockSize)
|
||||||
{
|
{
|
||||||
return block_cache_create(fDevice, numBlocks, blockSize, fMode == O_RDONLY);
|
return fBlockCache = block_cache_create(fDevice, numBlocks, blockSize,
|
||||||
|
IsReadOnly());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user