Bugfix: empty rsync_options line causes destroying source. (#8)

Bugfix: empty rsync_options line causes destroying source.
This commit is contained in:
Darko Poljak 2017-09-03 20:00:54 +02:00 committed by GitHub
parent 07c925de5d
commit 04bf9aff39

View file

@ -655,7 +655,17 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
#
if [ -f "${c_rsync_options}" ]; then
while read line; do
set -- "$@" "${line}"
# Trim line.
ln=$(echo "${line}" | awk '{$1=$1;print;}')
# Only if ln is non zero length string.
#
# If ln is empty then rsync '' DEST evaluates
# to transfer current directory to DEST which would
# with specific options destroy DEST content.
if [ -n "${ln}" ]
then
set -- "$@" "${ln}"
fi
done < "${c_rsync_options}"
fi