projects
/
BackupPC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
3.1.0 changes:
[BackupPC.git]
/
bin
/
BackupPC_compressPool
diff --git
a/bin/BackupPC_compressPool
b/bin/BackupPC_compressPool
index
a3d3583
..
e9845ef
100755
(executable)
--- a/
bin/BackupPC_compressPool
+++ b/
bin/BackupPC_compressPool
@@
-1,4
+1,4
@@
-#!/bin/perl
-T
+#!/bin/perl
#============================================================= -*-perl-*-
#
# BackupPC_compressPool: Compress existing pool
#============================================================= -*-perl-*-
#
# BackupPC_compressPool: Compress existing pool
@@
-31,7
+31,7
@@
# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
# Craig Barratt <cbarratt@users.sourceforge.net>
#
# 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
#
# 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
1.6.0_CVS, released 10 Dec 2002
.
+# Version
3.1.0, released 25 Nov 2007
.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use File::Find;
use File::Path;
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();
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";
my $BinDir = $bpc->BinDir();
my %Conf = $bpc->Conf();
my $PoolDir = "$TopDir/pool";
@@
-173,11
+175,12
@@
sub doCompress
-Bufsize => 65536,
-Level => $Compress,
);
-Bufsize => 65536,
-Level => $Compress,
);
- if ( !open(FH, $TestMode ? "<
$file" : "+<$file"
) ) {
+ if ( !open(FH, $TestMode ? "<
" : "+<", $file
) ) {
print("Error: Can't open $file for read/write\n");
$Errors++;
return;
}
print("Error: Can't open $file for read/write\n");
$Errors++;
return;
}
+ binmode(FH);
while ( sysread(FH, $dataIn, $CompMaxWrite) > 0 ) {
$flush = 0;
$FileOrigSz += length($dataIn);
while ( sysread(FH, $dataIn, $CompMaxWrite) > 0 ) {
$flush = 0;
$FileOrigSz += length($dataIn);
@@
-196,12
+199,13
@@
sub doCompress
}
$dataOut .= $fragOut;
if ( !$copy && length($dataOut) > $CompMaxWrite ) {
}
$dataOut .= $fragOut;
if ( !$copy && length($dataOut) > $CompMaxWrite ) {
- if ( !open(OUT, "+>$file.__z") ) {
+ if ( !open(OUT, "+>
", "
$file.__z") ) {
print("Error: Can't open $file.__z for write\n");
$Errors++;
close(FH);
return;
}
print("Error: Can't open $file.__z for write\n");
$Errors++;
close(FH);
return;
}
+ binmode(OUT);
$copy = 1;
}
if ( $copy && $dataOut ne "" ) {
$copy = 1;
}
if ( $copy && $dataOut ne "" ) {
@@
-237,13
+241,14
@@
sub doCompress
my $newFile = cpoolFileName($file);
if ( $TestMode ) {
close(FH);
my $newFile = cpoolFileName($file);
if ( $TestMode ) {
close(FH);
- if ( !open(FH, ">
$newFile"
) ) {
+ if ( !open(FH, ">
", $newFile
) ) {
print("Error: Can't open $newFile for write\n");
$Errors++;
close(FH);
unlink("$file.__z");
return;
}
print("Error: Can't open $newFile for write\n");
$Errors++;
close(FH);
unlink("$file.__z");
return;
}
+ binmode(FH);
}
if ( $copy ) {
if ( !sysseek(OUT, 0, 0) ) {
}
if ( $copy ) {
if ( !sysseek(OUT, 0, 0) ) {
@@
-323,12
+328,13
@@
sub checkRead
my($n, $nd, $r, $d, $d0);
local(*FH);
my($n, $nd, $r, $d, $d0);
local(*FH);
- if ( !open(FH, $file) ) {
+ if ( !open(FH,
"<",
$file) ) {
print("can't open $file for check\n");
$Errors++;
$f->close();
return;
}
print("can't open $file for check\n");
$Errors++;
$f->close();
return;
}
+ binmode(FH);
#print("comparing $file to $cfile\n");
while ( 1 ) {
$n = 1 + int(rand($CompMaxRead) + rand(100));
#print("comparing $file to $cfile\n");
while ( 1 ) {
$n = 1 + int(rand($CompMaxRead) + rand(100));
@@
-357,12
+363,13
@@
sub checkReadLine
my($n, $nd, $r, $d, $d0);
local(*FH);
my($n, $nd, $r, $d, $d0);
local(*FH);
- if ( !open(FH, $file) ) {
+ if ( !open(FH,
"<",
$file) ) {
print("can't open $file for check\n");
$Errors++;
$f->close();
return;
}
print("can't open $file for check\n");
$Errors++;
$f->close();
return;
}
+ binmode(FH);
while ( 1 ) {
$d0 = <FH>;
$d = $f->readLine();
while ( 1 ) {
$d0 = <FH>;
$d = $f->readLine();
@@
-393,8
+400,8
@@
sub compressHostFiles
if ( !defined($host) ) {
for ( my $i = 0 ; ; $i++ ) {
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);
}
} else {
@Backups = $bpc->BackupInfoRead($host);