Fix extra-wide field in freebsd quota
authorJamie Cameron <jcameron@webmin.com>
Sat, 25 Dec 2010 06:36:37 +0000 (22:36 -0800)
committerJamie Cameron <jcameron@webmin.com>
Sat, 25 Dec 2010 06:36:37 +0000 (22:36 -0800)
quota/freebsd-lib.pl
quota/linux-lib.pl

index e4b1732..fabdb28 100755 (executable)
@@ -111,7 +111,9 @@ $n=0; while(<QUOTA>) {
        if (/^(\S+)$/) {
                # Bogus wrapped line
                $filesys{$n,'filesys'} = $1;
-               <QUOTA>=~/^.{15}(.{8}).(.{7})(.{8}).{8}(.{8}).(.{7})(.{8})/;
+               local $nl = <QUOTA>;
+               $nl =~ /^\s+(\S+)\s+(\S+)\s+(\S+)(.{8}\s+)(\S+)\s+(\S+)\s+(\S+)(.*)/ ||
+                 $nl =~ /^.{15}(.{8}).(.{7})(.{8}).{8}(.{8}).(.{7})(.{8})/;
                $filesys{$n,'ublocks'} = int($1);
                $filesys{$n,'sblocks'} = int($2);
                $filesys{$n,'hblocks'} = int($3);
@@ -120,7 +122,8 @@ $n=0; while(<QUOTA>) {
                $filesys{$n,'hfiles'} = int($6);
                $n++;
                }
-       elsif (/^(.{15})(.{8}).(.{7})(.{8}).{8}(.{8}).(.{7})(.{8})/) {
+       elsif (/^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)(.{8}\s+)(\S+)\s+(\S+)\s+(\S+)(.*)/ ||
+              /^(.{15})(.{8}).(.{7})(.{8}).{8}(.{8}).(.{7})(.{8})/) {
                $filesys{$n,'ublocks'} = int($2);
                $filesys{$n,'sblocks'} = int($3);
                $filesys{$n,'hblocks'} = int($4);
index 53a8ef4..ff77b50 100755 (executable)
@@ -353,7 +353,7 @@ $n=0; while(<QUOTA>) {
                $filesys{$n,'filesys'} = $mtab{$1};
                local $nl = <QUOTA>;
                $nl =~/^\s+(\S+)\s+(\S+)\s+(\S+)(.{8}\s+)(\S+)\s+(\S+)\s+(\S+)(.*)/ ||
-                     /^.{15}.(.{7}).(.{7}).(.{7})(.{8}.)(.{7}).(.{7}).(.{7})(.*)/;
+                     $nl =~ /^.{15}.(.{7}).(.{7}).(.{7})(.{8}.)(.{7}).(.{7}).(.{7})(.*)/;
                $filesys{$n,'ublocks'} = int($1);
                $filesys{$n,'sblocks'} = int($2);
                $filesys{$n,'hblocks'} = int($3);