test_suite: fix: patching of too short log files

This commit is contained in:
Frank Liepold 2014-04-15 09:25:09 +02:00
parent c81084a33b
commit 4909130705
1 changed files with 4 additions and 0 deletions

View File

@ -107,6 +107,10 @@ function file_destroy_dd_on_logfile
local host=$1 logfile=$2 length=$3 local host=$1 logfile=$2 length=$3
local patch_length=$file_destroy_patch_length local patch_length=$file_destroy_patch_length
local offset=$(($length - $patch_length)) local offset=$(($length - $patch_length))
if [ $offset -lt 0 ]; then
offset=0
patch_length=$length
fi
lib_vmsg " patching the last $patch_length bytes in $host:$logfile" lib_vmsg " patching the last $patch_length bytes in $host:$logfile"
lib_remote_idfile $host "printf '%.${patch_length}d' | dd of=$logfile bs=1 conv=notrunc count=$patch_length seek=$offset" || lib_exit 1 lib_remote_idfile $host "printf '%.${patch_length}d' | dd of=$logfile bs=1 conv=notrunc count=$patch_length seek=$offset" || lib_exit 1
} }