Skip to content

Commit

Permalink
get device name from file content, not file name
Browse files Browse the repository at this point in the history
SUSE has names for block devices in /dev/.udev/db/ like b<major>:<minor>
(ex. b8:0)

Reported-by: Alexander Evseev <PunchyBummer@mailinator.com>
  • Loading branch information
guillomovitch authored and Gonéri Le Bouder committed May 24, 2012
1 parent d63f1a7 commit 895566e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/FusionInventory/Agent/Tools/Linux.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ sub getDevicesFromUdev {
my @devices;

foreach my $file (glob ("/dev/.udev/db/*")) {
next unless $file =~ /([sh]d[a-z])$/;
my $device = $1;
my $device = getFirstMatch(
file => $file,
pattern => qr/^N:(\S+)/
);
next unless $device =~ /([hsv]d[a-z]|sr\d+)$/;
push (@devices, _parseUdevEntry(
logger => $params{logger}, file => $file, device => $device
));
Expand Down

0 comments on commit 895566e

Please sign in to comment.