X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_compressPool;h=e9845ef65ae1e925bbcb7e0e5620768c69421c69;hp=3796c75d88706b8480994f0a3c491e3f364238d0;hb=fda25dc88a63ccac1c80efa2e4994bf0725ca9b7;hpb=74dc9d456332757127d5eda4ce32f29377133fa2 diff --git a/bin/BackupPC_compressPool b/bin/BackupPC_compressPool index 3796c75..e9845ef 100755 --- a/bin/BackupPC_compressPool +++ b/bin/BackupPC_compressPool @@ -1,4 +1,4 @@ -#!/bin/perl -T +#!/bin/perl #============================================================= -*-perl-*- # # BackupPC_compressPool: Compress existing pool @@ -31,7 +31,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001 Craig Barratt +# Copyright (C) 2001-2007 Craig Barratt # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -49,13 +49,14 @@ # #======================================================================== # -# Version 2.0.0beta3, released 1 Jun 2003. +# Version 3.1.0, released 25 Nov 2007. # # See http://backuppc.sourceforge.net. # #======================================================================== use strict; +no utf8; use File::Find; use File::Path; @@ -68,6 +69,7 @@ use BackupPC::FileZIO; die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); $bpc->ChildInit(); my $TopDir = $bpc->TopDir(); +my $LogDir = $bpc->LogDir(); my $BinDir = $bpc->BinDir(); my %Conf = $bpc->Conf(); my $PoolDir = "$TopDir/pool"; @@ -178,6 +180,7 @@ sub doCompress $Errors++; return; } + binmode(FH); while ( sysread(FH, $dataIn, $CompMaxWrite) > 0 ) { $flush = 0; $FileOrigSz += length($dataIn); @@ -202,6 +205,7 @@ sub doCompress close(FH); return; } + binmode(OUT); $copy = 1; } if ( $copy && $dataOut ne "" ) { @@ -244,6 +248,7 @@ sub doCompress unlink("$file.__z"); return; } + binmode(FH); } if ( $copy ) { if ( !sysseek(OUT, 0, 0) ) { @@ -329,6 +334,7 @@ sub checkRead $f->close(); return; } + binmode(FH); #print("comparing $file to $cfile\n"); while ( 1 ) { $n = 1 + int(rand($CompMaxRead) + rand(100)); @@ -363,6 +369,7 @@ sub checkReadLine $f->close(); return; } + binmode(FH); while ( 1 ) { $d0 = ; $d = $f->readLine(); @@ -393,8 +400,8 @@ sub compressHostFiles if ( !defined($host) ) { for ( my $i = 0 ; ; $i++ ) { - last if ( !-f "$TopDir/log/LOG.$i" ); - push(@Files, "$TopDir/log/LOG.$i"); + last if ( !-f "$LogDir/LOG.$i" ); + push(@Files, "$LogDir/LOG.$i"); } } else { @Backups = $bpc->BackupInfoRead($host);