CcMapData(): Workaround missing 'FileObject->DeviceObject->SectorSize' during mount
authorshort <>
Mon, 3 Feb 2003 23:05:01 +0000 (23:05 +0000)
committershort <>
Mon, 3 Feb 2003 23:05:01 +0000 (23:05 +0000)
src/libcaptive/cc/map.c

index 22df5ef..d2a0ceb 100644 (file)
@@ -356,10 +356,14 @@ GPtrArray *read_array;
                }
        g_return_val_if_fail(FileObject->DeviceObject!=NULL,FALSE);
        /* Is PAGE_SIZE aligned with 'FileObject->DeviceObject->SectorSize'?
-        * 'SectorSize' may not yet be filled in.
+        * 'SectorSize' may not yet be initialized during mount operation
+        * and such state can be detected by missing 'FileObject->DeviceObject->Vpb'.
         */
-       g_return_val_if_fail(!FileObject->DeviceObject->SectorSize
-                       || 0==CAPTIVE_ROUND_DOWN_EXCEEDING(PAGE_SIZE,FileObject->DeviceObject->SectorSize),FALSE);
+       g_return_val_if_fail(0
+                                       || !FileObject->DeviceObject->Vpb       /* not yet much ready */
+                                       || (FileObject->DeviceObject->SectorSize>0      /* prevent division by 0 */
+                                                       && 0==CAPTIVE_ROUND_DOWN_EXCEEDING(PAGE_SIZE,FileObject->DeviceObject->SectorSize)),
+                       FALSE);
 
        page_position_hash_init();
        private_bcb_hash_init();