Ignore:
Timestamp:
Nov 18, 2019, 12:02:21 PM (4 years ago)
Author:
Bruno Cornec
Message:

Fix non working mr-device-mounted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/MondoRescue/lib/MondoRescue/Disk.pm

    r3553 r3742  
    105105my $device = shift;
    106106
    107 return(1) if ((not defined $device) || ($device =~ "^/sys|^/proc"));
     107return("") if ((not defined $device) || ($device =~ "^/sys|^/proc"));
    108108
     109# Beware of how hashes are handled in these functions
    109110my $h = mr_file_read_all_link($device);
    110111# Preserve that hash locally before earsing it to reuse another one
     
    114115    pb_log(2,"Working on device $f\n");
    115116    # TODO: get them from a conf file - FreeBSD needs swapinfo for swap request
    116     foreach my $dev ("mount","cat /proc/swaps") {
     117    foreach my $dev ("mount","grep -Ev '^Filename' /proc/swaps") {
    117118        # Look for the device in the command result
    118119        open(MOUNT,"$dev|") || die "Unable to execute the $dev command";
    119120        while (<MOUNT>) {
    120             my ($mntp,$void) = split('\s',$_,2);
     121            my ($mntp,$v1,$dir,$v3) = split('\s',$_,4);
    121122            $h = mr_file_read_all_link($mntp);
    122123            foreach my $m (keys %$h) {
     
    124125                if ($m eq $f) {
    125126                    # Find the mountpoint and return it
    126                     my ($void1,$mountpoint,$void2) = split('\s',$void);
    127                     pb_log(2,"*** Found $m on $mountpoint\n") if (defined $mountpoint);
    128                     return($mountpoint);
     127                    pb_log(2,"*** Found $m on $dir\n") if (defined $dir);
     128                    # Clean before returning
     129                    mr_file_erase_hash($h);
     130                    mr_file_erase_hash($h2);
     131                    return($dir);
    129132                }
    130133            }
    131             my $h3 = mr_file_copy_and_erase_hash($h);
     134            mr_file_erase_hash($h);
    132135        }
    133136        close(MOUNT);
Note: See TracChangeset for help on using the changeset viewer.