Improve logic for retrieval of device udev name

This commit is contained in:
Curtis Gedak 2009-09-30 16:25:19 -06:00
parent 78c3174694
commit fa0b88c701
1 changed files with 6 additions and 1 deletions

View File

@ -207,11 +207,16 @@ Glib::ustring DMRaid::get_udev_name( const Glib::ustring & dev_path )
Glib::ustring udev_name = "" ; Glib::ustring udev_name = "" ;
if ( udevinfo_found ) if ( udevinfo_found )
{
if ( ! Utils::execute_command( "udevinfo --query=name --name=" + dev_path, output, error, true ) ) if ( ! Utils::execute_command( "udevinfo --query=name --name=" + dev_path, output, error, true ) )
udev_name = output ; udev_name = output ;
}
else if ( udevadm_found ) else if ( udevadm_found )
if ( ! Utils::execute_command( "udevadm info --query=name --name=" + DEV_MAP_PATH + dev_path, output, error, true ) ) {
if ( ! Utils::execute_command( "udevadm info --query=name --name=" + dev_path, output, error, true ) )
udev_name = output ; udev_name = output ;
}
if ( ! udev_name .empty() ) if ( ! udev_name .empty() )
{ {
//Extract portion of name after last '/' //Extract portion of name after last '/'