mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
img: Remove empty lazy images after dump
If dump doesn't generate data into some image file the respective file is not created at all as it used to be in 1.5. This brings potential problem -- if the file with the image name exists during dump (e.g. a dump file left from previous, maybe unsuccessful, dump) then restore would pick this file and read bad/wrong/fake data from it. To return the proper behavior back the file with the name of empty image should be removed. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
5e55b71b93
commit
c9c41ddfa9
10
image.c
10
image.c
@ -369,9 +369,15 @@ int open_image_lazy(struct cr_img *img)
|
||||
|
||||
void close_image(struct cr_img *img)
|
||||
{
|
||||
if (lazy_image(img))
|
||||
if (lazy_image(img)) {
|
||||
/*
|
||||
* Remove the image file if it's there so that
|
||||
* subsequent restore doesn't read wrong or fake
|
||||
* data from it.
|
||||
*/
|
||||
unlinkat(get_service_fd(IMG_FD_OFF), img->path, 0);
|
||||
xfree(img->path);
|
||||
else if (!empty_image(img))
|
||||
} else if (!empty_image(img))
|
||||
bclose(&img->_x);
|
||||
|
||||
xfree(img);
|
||||
|
Loading…
x
Reference in New Issue
Block a user