[block-cache] fix potential file descriptor leak
Encapsulate file descriptor into an object, to ensure that an fd will be closed properly while exception raised, e.g., the block_cache throws exception during the block_manager's construction.
This commit is contained in:
@ -38,7 +38,7 @@ namespace thin_provisioning {
|
||||
block_address nr_blocks_;
|
||||
block_address cache_blocks_;
|
||||
|
||||
int fd_;
|
||||
file_utils::file_descriptor fd_;
|
||||
validator::ptr v_;
|
||||
std::unique_ptr<block_cache> cache_;
|
||||
|
||||
|
Reference in New Issue
Block a user