+ if ( defined($a->{fhOut}) ) {
+ if ( $a->{fileName} =~ /(.*)\// ) {
+ $fileName = $1;
+ } else {
+ $fileName = ".";
+ }
+ #
+ # Find a unique target temporary file name
+ #
+ my $i = 0;
+ while ( -f "$fileName/t$$.$i" ) {
+ $i++;
+ }
+ $fileName = "$fileName/t$$.$i";
+ $a->{fhOut}->close();
+ if ( !rename($a->{fileName}, $fileName)
+ || !defined($fh = BackupPC::FileZIO->open($fileName, 0,
+ $a->{compress})) ) {
+ push(@{$a->{errors}}, "Can't rename $a->{fileName} -> $fileName"
+ . " or open during size fixup\n");
+ }
+ #print("Using temporary name $fileName\n");
+ } elsif ( defined($a->{files}) && defined($a->{files}[0]) ) {
+ #
+ # We haven't written anything yet, so just use the
+ # compare file to copy from.
+ #
+ $fh = $a->{files}[0]->{fh};
+ $fh->rewind;
+ #print("Using compare file $a->{files}[0]->{name}\n");