From 118d7587b6d4ad34224b7bf7370bdfbe941ffe3c Mon Sep 17 00:00:00 2001
From: Silvio Rhatto <rhatto@riseup.net>
Date: Sat, 12 May 2012 21:48:43 -0300
Subject: [PATCH] Changing pipefail just when it's really needed

---
 handlers/rsync.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/handlers/rsync.in b/handlers/rsync.in
index 85e1c99..1f7fb4d 100644
--- a/handlers/rsync.in
+++ b/handlers/rsync.in
@@ -1131,7 +1131,6 @@ set_rsync_options
 start_mux
 stop_services
 mount_rw
-set_pipefail
 
 starttime="`date +%c%n%s`"
 echo "Starting backup at `echo $starttime | head -n 1`" >> $log
@@ -1146,17 +1145,18 @@ for SECTION in $include; do
 
   info "Syncing $SECTION on $dest_path..."
   debug $nice $rsync "${rsync_options[@]}" $filelist_flag $excludes $batch_option $orig $dest_path
+  set_pipefail
   $nice $rsync "${rsync_options[@]}" $filelist_flag $excludes $batch_option $orig $dest_path | tee -a $log
 
   if [ "$?" != "0" ]; then
     fatal "Rsync error when trying to transfer $SECTION"
   fi
 
+  restore_pipefail
   update_metadata
 
 done
 
-restore_pipefail
 mount_ro
 run_fsck
 start_services
-- 
GitLab