You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gparted/gparted-devices.patch

37 lines
1.1 KiB

--- src/GParted_Core.cc 2006/12/08 13:14:05 759
+++ src/GParted_Core.cc 2007/01/07 20:29:03 764
@@ -155,7 +155,20 @@
lp_device = ped_device_get_next( NULL );
while ( lp_device )
{
- device_paths .push_back( lp_device ->path ) ;
+ //only add this device if we can read the first sector (which means it's a real device)
+ char * buf = static_cast<char *>( malloc( lp_device ->sector_size ) ) ;
+ if ( buf )
+ {
+ if ( ped_device_open( lp_device ) )
+ {
+ if ( ped_device_read( lp_device, buf, 0, 1 ) )
+ device_paths .push_back( lp_device ->path ) ;
+
+ ped_device_close( lp_device ) ;
+ }
+
+ free( buf ) ;
+ }
lp_device = ped_device_get_next( lp_device ) ;
}
@@ -163,10 +176,10 @@
std::sort( device_paths .begin(), device_paths .end() ) ;
}
-
+
for ( unsigned int t = 0 ; t < device_paths .size() ; t++ )
{
- if ( device_paths[ t ] .length() > 6 && device_paths[ t ] .is_ascii() && open_device_and_disk( device_paths[ t ], false ) )
+ if ( open_device_and_disk( device_paths[ t ], false ) )
{
temp_device .Reset() ;