diff -r e65d90b1682d -r 603b47708d37 bin/imager.save --- a/bin/imager.save Fri Aug 19 15:10:12 2011 +0200 +++ b/bin/imager.save Fri Aug 19 15:30:00 2011 +0200 @@ -121,7 +121,6 @@ open(my $in => $src); binmode($in); - local $/ = \$o{blocksize}; local $| = 1; my %stats = ( @@ -145,14 +144,15 @@ }; $SIG{ALRM}->(); - while (my $buffer = <$in>) { + for (my $blknr = 0; sysread($in => my $buffer, $o{blocksize}) > 0; ++$blknr) { + my ($file, $ext, $cs); $file = $cs = md5_hex($buffer); $file =~ s/(?(?...).*)/$+{prefix}\/$+{fn}/g; $ext .= $o{pass} ? ".x" : ""; # the extension we do not put into the index - push @{ $index{BLOCKS} }, sprintf "%12d %s %s" => ($. - 1), + push @{ $index{BLOCKS} }, sprintf "%12d %s %s" => $blknr, $cs, $file; if (not Imager::get_file("$data/$file")) { @@ -184,7 +184,7 @@ syswrite $out => $buffer; close($out); rename($out => "$data/$file$ext"); - $index{BLOCKS}[$. - 1] .= " *"; + $index{BLOCKS}[$blknr] .= " *"; $stats{written}++; } else {