"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "bin/BackupPC_zcat" between
BackupPC-4.3.2.tar.gz and BackupPC-4.4.0.tar.gz

About: BackupPC is a high-performance, enterprise-grade system for backing up Linux and WinXX PCs and laptops to a server’s disk (http/cgi user interface).

BackupPC_zcat  (BackupPC-4.3.2):BackupPC_zcat  (BackupPC-4.4.0)
skipping to change at line 38 skipping to change at line 38
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
#======================================================================== #========================================================================
# #
# Version 4.3.2, released 17 Feb 2020. # Version 4.4.0, released 20 Jun 2020.
# #
# See http://backuppc.sourceforge.net. # See http://backuppc.sourceforge.net.
# #
#======================================================================== #========================================================================
use strict; use strict;
no utf8; no utf8;
use lib "__INSTALLDIR__/lib"; use lib "__INSTALLDIR__/lib";
use Compress::Zlib; use Compress::Zlib;
use BackupPC::XS qw( :all ); use BackupPC::XS qw( :all );
use BackupPC::Lib; use BackupPC::Lib;
use BackupPC::View; use BackupPC::View;
use Getopt::Std; use Getopt::Std;
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
my $TopDir = $bpc->TopDir(); my $TopDir = $bpc->TopDir();
skipping to change at line 83 skipping to change at line 83
# #
# first case is an MD5 digest - try to find it in the pool (if it doesn' t exist as a file) # first case is an MD5 digest - try to find it in the pool (if it doesn' t exist as a file)
# #
if ( !defined($opts{h}) && !-f $file && $file =~ /^[\da-f]{16,}$/ ) { if ( !defined($opts{h}) && !-f $file && $file =~ /^[\da-f]{16,}$/ ) {
my $poolFile = $bpc->MD52Path(pack("H*", $file), $Conf{CompressLevel }); my $poolFile = $bpc->MD52Path(pack("H*", $file), $Conf{CompressLevel });
$file = $poolFile if ( -f $poolFile ); $file = $poolFile if ( -f $poolFile );
} }
# #
# second case is a path that exists # second case is a path that exists
# #
if ( !defined($opts{h}) && -f $file && defined(my $fh = BackupPC::XS::Fi if ( !defined($opts{h})
leZIO::open($file, 0, $Conf{CompressLevel})) ) { && -f $file
&& defined(my $fh = BackupPC::XS::FileZIO::open($file, 0, $Conf{Comp
ressLevel})) ) {
$ret ||= zcat($fh, $file); $ret ||= zcat($fh, $file);
next; next;
} }
# #
# now see if it's a client file path, or a mangled stored path. # now see if it's a client file path, or a mangled stored path.
# #
my($Host, $Num, $Share, $View, @Backups, $i); my($Host, $Num, $Share, $View, @Backups, $i);
if ( !defined($opts{h}) && $file =~ m{^\Q$TopDir\E/pc/([^/]*)/(\d+)/(.*) } ) { if ( !defined($opts{h}) && $file =~ m{^\Q$TopDir\E/pc/([^/]*)/(\d+)/(.*) } ) {
$Host = $1; $Host = $1;
$Num = $2; $Num = $2;
skipping to change at line 109 skipping to change at line 111
$Share = $file; $Share = $file;
$file = "/"; $file = "/";
} }
$Share = $bpc->fileNameUnmangle($Share); $Share = $bpc->fileNameUnmangle($Share);
$file = $bpc->fileNameUnmangle($file); $file = $bpc->fileNameUnmangle($file);
} else { } else {
if ( !defined($opts{h}) || !defined($opts{n}) || !defined($opts{s}) ) { if ( !defined($opts{h}) || !defined($opts{n}) || !defined($opts{s}) ) {
print(STDERR "BackupPC_zcat: can't find $file\n"); print(STDERR "BackupPC_zcat: can't find $file\n");
exit(1); exit(1);
} }
$Host = $opts{h}; $Host = $opts{h};
$Num = $opts{n}; $Num = $opts{n};
$Share = $opts{s}; $Share = $opts{s};
} }
@Backups = $bpc->BackupInfoRead($Host); @Backups = $bpc->BackupInfoRead($Host);
$Num = $Backups[@Backups + $Num]{num} if ( -@Backups <= $Num && $Num < 0 ); $Num = $Backups[@Backups + $Num]{num} if ( -@Backups <= $Num && $Num < 0 );
for ( $i = 0 ; $i < @Backups ; $i++ ) { for ( $i = 0 ; $i < @Backups ; $i++ ) {
last if ( $Backups[$i]{num} == $Num ); last if ( $Backups[$i]{num} == $Num );
} }
if ( $i >= @Backups ) { if ( $i >= @Backups ) {
print(STDERR "BackupPC_zcat: backup #$Num doesn't exist for host $Ho st\n"); print(STDERR "BackupPC_zcat: backup #$Num doesn't exist for host $Ho st\n");
exit(1); exit(1);
} }
$View = BackupPC::View->new($bpc, $Host, \@Backups); $View = BackupPC::View->new($bpc, $Host, \@Backups);
my $a = $View->fileAttrib($Num, $Share, $file); my $a = $View->fileAttrib($Num, $Share, $file);
if ( !defined($a) ) { if ( !defined($a) ) {
skipping to change at line 159 skipping to change at line 161
sub zcat sub zcat
{ {
my($fh, $fileName) = @_; my($fh, $fileName) = @_;
my($data, $r, $ret); my($data, $r, $ret);
while ( ($r = $fh->read(\$data, 4 * 65536)) > 0 ) { while ( ($r = $fh->read(\$data, 4 * 65536)) > 0 ) {
print($data); print($data);
} }
if ( $r < 0 ) { if ( $r < 0 ) {
print(STDERR "$0: can't uncompress $fileName\n"); print(STDERR "$0: can't uncompress $fileName\n");
$ret = 1; $ret = 1;
} }
$fh->close(); $fh->close();
return $ret; return $ret;
} }
 End of changes. 6 change blocks. 
9 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)