Modules/LVM - (minor) Error handler in AddVolume
authorJohn Hodge <[email protected]>
Thu, 20 Jun 2013 06:45:41 +0000 (14:45 +0800)
committerJohn Hodge <[email protected]>
Thu, 20 Jun 2013 06:45:41 +0000 (14:45 +0800)
KernelLand/Modules/Storage/LVM/volumes.c

index d7091bb..af19868 100644 (file)
@@ -45,7 +45,11 @@ void *LVM_AddVolume(const tLVM_VolType *Type, const char *Name, void *Ptr, size_
                Log_Error("LVM", "LVM_AddVolume - malloc error on %i bytes", BlockSize);
                return NULL;
        }
-       Type->Read(Ptr, 0, 1, first_block);
+       if( Type->Read(Ptr, 0, 1, first_block) != 1 ) {
+               Log_Error("LVM", "LVM_AddVolume - Failed to read first sector");
+               free(first_block);
+               return NULL;
+       }
        
        // Determine Format
        // TODO: Determine format

UCC git Repository :: git.ucc.asn.au