diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | lib/MDK/Common/System.pm | 8 |
2 files changed, 8 insertions, 1 deletions
@@ -1,6 +1,7 @@ Version 1.2.20 - 13 August 2009, by Aurelien Lefebvre - Call fsync after writing to ensure that files are written +- fix df on mips, statfs structure is different from x86 Version 1.2.19 - 09 June 2009, by Eugeni Dodonov 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; } |