mirror: Make sure that source and target size match
commite83dd6808c6e0975970f37b49b27cc37bb54eea8
authorKevin Wolf <kwolf@redhat.com>
Mon, 11 May 2020 13:58:24 +0000 (11 15:58 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 18 May 2020 17:05:24 +0000 (18 19:05 +0200)
tree55c0f585763840d84a641483f5abb62fbf1abf0d
parentd89ac3cf305b28c024a76805a84d75c0ee1e786f
mirror: Make sure that source and target size match

If the target is shorter than the source, mirror would copy data until
it reaches the end of the target and then fail with an I/O error when
trying to write past the end.

If the target is longer than the source, the mirror job would complete
successfully, but the target wouldn't actually be an accurate copy of
the source image (it would contain some additional garbage at the end).

Fix this by checking that both images have the same size when the job
starts.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200511135825.219437-4-kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/mirror.c