added only_increment param to all action=browse links
[BackupPC.git] / lib / BackupPC / Xfer / RsyncFileIO.pm
index fd2df3b..6cbefe1 100644 (file)
@@ -8,11 +8,25 @@
 #   Craig Barratt  <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2002-2003  Craig Barratt
+#   Copyright (C) 2002-2009  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
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 #========================================================================
 #
-# Version 3.1.0beta0, released 3 Sep 2007.
+# Version 3.2.0, released 31 Jul 2010.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -162,6 +176,12 @@ sub csumStart
                                      $defBlkSize, $fio->{checksumSeed},
                                      0, $attr->{compress}, 0,
                                      $fio->{protocol_version});
+        if ( $err ) {
+            $fio->log("Can't get rsync digests from $attr->{fullPath}"
+                    . " (err=$err, name=$f->{name})");
+            $fio->{stats}{errorCnt}++;
+            return -1;
+        }
         my($isCached, $isInvalid) = $d->isCached;
         if ( $fio->{logLevel} >= 5 ) {
             $fio->log("$attr->{fullPath} verify; cached = $isCached,"
@@ -596,7 +616,10 @@ sub processClose
     my($exists, $digest, $outSize, $errs) = $poolWrite->close;
 
     $fileName =~ s{^/+}{};
-    $fio->log(@$errs) if ( defined($errs) && @$errs );
+    if ( defined($errs) && @$errs ) {
+        $fio->log(@$errs);
+        $fio->{stats}{errorCnt} += @$errs;
+    }
     if ( $doStats ) {
        $fio->{stats}{TotalFileCnt}++;
        $fio->{stats}{TotalFileSize} += $origSize;
@@ -638,7 +661,7 @@ sub makePath
     $fio->logFileAction("create", $f) if ( $fio->{logLevel} >= 1 );
     $fio->log("makePath($path, 0777)") if ( $fio->{logLevel} >= 5 );
     $path = $1 if ( $path =~ /(.*)/s );
-    File::Path::mkpath($path, 0, 0777) if ( !-d $path );
+    eval { File::Path::mkpath($path, 0, 0777) } if ( !-d $path );
     return $fio->attribSet($f) if ( -d $path );
     $fio->log("Can't create directory $path");
     $fio->{stats}{errorCnt}++;
@@ -1155,11 +1178,11 @@ sub fileDeltaRxDone
             if ( $phase > 0 ) {
                 $fio->log("$name: fatal error: md4 doesn't match on retry;"
                         . " file removed");
+                $fio->{stats}{errorCnt}++;
             } else {
                 $fio->log("$name: md4 doesn't match: will retry in phase 1;"
                         . " file removed");
             }
-            $fio->{stats}{errorCnt}++;
             if ( defined($fio->{rxOutFd}) ) {
                 $fio->{rxOutFd}->close;
                 unlink($fio->{rxOutFile});