Skip to content

Commit

Permalink
[driver] Avoid disabling disks that have already been enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
  • Loading branch information
TalAloni authored and mcb30 committed Oct 9, 2011
1 parent 4fb36fc commit 3f33a9e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/driver/sanbootconf.c
Expand Up @@ -313,7 +313,13 @@ static NTSTATUS check_system_disk ( PUNICODE_STRING name,

/* Enable interface if not already done */
status = IoSetDeviceInterfaceState ( name, TRUE );
must_disable = ( NT_SUCCESS ( status ) ? TRUE : FALSE );
/* If interface is already enabled, IoSetDeviceInterfaceState
* will return STATUS_OBJECT_NAME_EXISTS, which counts as a
* success status.
*/
must_disable = ( ( NT_SUCCESS ( status ) &&
( status != STATUS_OBJECT_NAME_EXISTS ) )
? TRUE : FALSE );

/* Get device and file object pointers */
status = IoGetDeviceObjectPointer ( name, FILE_ALL_ACCESS, &file,
Expand Down

0 comments on commit 3f33a9e

Please sign in to comment.