* 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:
Axel Dörfler 2008-03-25 12:52:30 +00:00
parent 41f8d41647
commit 2b1003a09a
1 changed files with 3 additions and 2 deletions

View File

@ -74,7 +74,7 @@ DeviceOpener::DeviceOpener(int fd, int mode)
DeviceOpener::~DeviceOpener()
{
if (fDevice >= B_OK) {
if (fDevice >= 0) {
RemoveCache(false);
close(fDevice);
}
@ -129,7 +129,8 @@ DeviceOpener::Open(int fd, int mode)
void *
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());
}