Added some missing error checking in Mount() when investigating file set descriptor
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5646 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
730ba00a62
commit
d8b4553a67
@ -206,7 +206,7 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length,
|
|||||||
if (!error) {
|
if (!error) {
|
||||||
MemoryChunk chunk(logicalVolumeDescriptor.file_set_address().length());
|
MemoryChunk chunk(logicalVolumeDescriptor.file_set_address().length());
|
||||||
|
|
||||||
status_t error = chunk.InitCheck();
|
error = chunk.InitCheck();
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
off_t address;
|
off_t address;
|
||||||
@ -218,7 +218,7 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length,
|
|||||||
if (!error) {
|
if (!error) {
|
||||||
ssize_t bytesRead = read_pos(device, address, chunk.Data(),
|
ssize_t bytesRead = read_pos(device, address, chunk.Data(),
|
||||||
blockSize);
|
blockSize);
|
||||||
if (bytesRead != (ssize_t)blockSize) {
|
if (bytesRead != ssize_t(blockSize)) {
|
||||||
error = B_IO_ERROR;
|
error = B_IO_ERROR;
|
||||||
PRINT(("read_pos(pos:%Ld, len:%ld) failed with: 0x%lx\n",
|
PRINT(("read_pos(pos:%Ld, len:%ld) failed with: 0x%lx\n",
|
||||||
address, blockSize, bytesRead));
|
address, blockSize, bytesRead));
|
||||||
@ -228,10 +228,15 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length,
|
|||||||
if (!error) {
|
if (!error) {
|
||||||
file_set_descriptor *fileSet =
|
file_set_descriptor *fileSet =
|
||||||
reinterpret_cast<file_set_descriptor*>(chunk.Data());
|
reinterpret_cast<file_set_descriptor*>(chunk.Data());
|
||||||
fileSet->tag().init_check(0);
|
error = fileSet->tag().id() == TAGID_FILE_SET_DESCRIPTOR
|
||||||
PDUMP(fileSet);
|
? B_OK : B_ERROR;
|
||||||
fRootIcb = new Icb(this, fileSet->root_directory_icb());
|
if (!error)
|
||||||
error = fRootIcb ? fRootIcb->InitCheck() : B_NO_MEMORY;
|
error = fileSet->tag().init_check(0);
|
||||||
|
if (!error) {
|
||||||
|
PDUMP(fileSet);
|
||||||
|
fRootIcb = new Icb(this, fileSet->root_directory_icb());
|
||||||
|
error = fRootIcb ? fRootIcb->InitCheck() : B_NO_MEMORY;
|
||||||
|
}
|
||||||
if (!error) {
|
if (!error) {
|
||||||
error = new_vnode(Id(), RootIcb()->Id(), (void*)RootIcb());
|
error = new_vnode(Id(), RootIcb()->Id(), (void*)RootIcb());
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -291,6 +296,7 @@ Volume::MapBlock(long_address address, off_t *mappedBlock)
|
|||||||
void
|
void
|
||||||
Volume::_Unset()
|
Volume::_Unset()
|
||||||
{
|
{
|
||||||
|
DEBUG_INIT("Volume");
|
||||||
fId = 0;
|
fId = 0;
|
||||||
fDevice = 0;
|
fDevice = 0;
|
||||||
fMounted = false;
|
fMounted = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user