From 4b3bf6e924d16ec4e187ac19889b76747eb096ae Mon Sep 17 00:00:00 2001 From: Matt Palmer Date: Mon, 9 Mar 2015 08:19:46 +1100 Subject: [PATCH] Avoid truncating image files Thanks to inejge for reporting, and the patch. --- bin/lvmsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/lvmsync b/bin/lvmsync index cc69159..56c1962 100755 --- a/bin/lvmsync +++ b/bin/lvmsync @@ -145,7 +145,7 @@ def process_dumpdata(instream, destdev, snapback = nil, opts = {}) snapback.puts handshake if snapback verbose "Writing changed data to #{destdev.inspect}" - File.open(destdev, 'w+') do |dest| + File.open(destdev, 'r+') do |dest| while header = instream.read(12) offset, chunksize = header.unpack("QN") offset = ntohq(offset)