diff options
author | Olivier Blin <oblin@mandriva.com> | 2009-10-07 15:41:32 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2009-10-07 15:41:32 +0000 |
commit | 48644a537553d6d6afde14ebd03c5d4742d5e7b4 (patch) | |
tree | 05e70d8ae9909f137358a92d971e202b8c76a9f4 /lib/MDK | |
parent | eba3903990e848315cf1bccef893661a5062332e (diff) | |
download | perl-MDK-Common-48644a537553d6d6afde14ebd03c5d4742d5e7b4.tar perl-MDK-Common-48644a537553d6d6afde14ebd03c5d4742d5e7b4.tar.gz perl-MDK-Common-48644a537553d6d6afde14ebd03c5d4742d5e7b4.tar.bz2 perl-MDK-Common-48644a537553d6d6afde14ebd03c5d4742d5e7b4.tar.xz perl-MDK-Common-48644a537553d6d6afde14ebd03c5d4742d5e7b4.zip |
fix df on mips, statfs structure is different from x86 (from Arnaud Patard)
Diffstat (limited to 'lib/MDK')
-rw-r--r-- | lib/MDK/Common/System.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/MDK/Common/System.pm b/lib/MDK/Common/System.pm index 1b24f21..f7d0f63 100644 --- a/lib/MDK/Common/System.pm +++ b/lib/MDK/Common/System.pm @@ -310,7 +310,13 @@ sub df { my ($blocksize, $size, $free); my $buf = ' ' x 20000; syscall_('statfs', $mntpoint, $buf) or return; - (undef, $blocksize, $size, $free, undef, undef) = unpack "L!6", $buf; + # at least on mips the statfs structure is different to x86 + # Should we use bavail or bfree ? + if (arch() =~ /mips/) { + (undef, $blocksize, undef, $size, $free, undef, undef, $avail) = unpack "L!8", $buf; + } else { + (undef, $blocksize, $size, $free, undef, undef) = unpack "L!6", $buf; + } map { $_ * ($blocksize / 1024) } $size, $free; } |