From 42340683af48c57139ec96639ad6fd9be1f14a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 10 Jan 2005 07:22:36 +0000 Subject: [PATCH] The identify hook must return an error in case of an error, not 0.0f - or else the scan partition hook will be called with an invalid cookie. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10631 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../file_systems/bfs/disk_device_interface.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/disk_device_interface.cpp b/src/add-ons/kernel/file_systems/bfs/disk_device_interface.cpp index cbf52db07d..31cb360db1 100644 --- a/src/add-ons/kernel/file_systems/bfs/disk_device_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/disk_device_interface.cpp @@ -1,7 +1,7 @@ /* -** Copyright 2004, Axel Dörfler, axeld@pinc-software.de -** This file may be used under the terms of the Haiku License. -*/ + * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de + * This file may be used under the terms of the MIT License. + */ /* This file contains the module interface to the disk device manager. * Currently, only the part for identifying and scanning a volume is implemented. @@ -28,8 +28,9 @@ static float bfs_identify_partition(int fd, partition_data *partition, void **_cookie) { disk_super_block superBlock; - if (Volume::Identify(fd, &superBlock) != B_OK) - return 0.0f; + status_t status = Volume::Identify(fd, &superBlock); + if (status != B_OK) + return status; identify_cookie *cookie = new identify_cookie; memcpy(&cookie->super_block, &superBlock, sizeof(disk_super_block)); @@ -48,8 +49,9 @@ bfs_scan_partition(int fd, partition_data *partition, void *_cookie) partition->flags |= B_PARTITION_FILE_SYSTEM; partition->content_size = cookie->super_block.NumBlocks() * cookie->super_block.BlockSize(); partition->block_size = cookie->super_block.BlockSize(); - partition->content_name = strdup(cookie->super_block.name); + if (partition->content_name == NULL) + return B_NO_MEMORY; return B_OK; }