Commit 218f0a9b authored by Pavel Emelyanov's avatar Pavel Emelyanov

fifo: Fix false failure on fifo image reading

The ret var is set to -1 at the beginning and the very first loop
will break and report it to the caller thus stopping the restore :(
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 883126a4
...@@ -158,22 +158,20 @@ static int handle_fifo_data(void) ...@@ -158,22 +158,20 @@ static int handle_fifo_data(void)
int collect_fifo(void) int collect_fifo(void)
{ {
struct fifo_info *info = NULL; struct fifo_info *info = NULL;
int img, ret = -1; int img, ret;
img = open_image_ro(CR_FD_FIFO); img = open_image_ro(CR_FD_FIFO);
if (img < 0) if (img < 0)
return -1; return -1;
while (1) { while (1) {
ret = -1;
info = xzalloc(sizeof(*info)); info = xzalloc(sizeof(*info));
if (info) { if (!info)
info->fe = xzalloc(sizeof(*info->fe)); break;
if (!info->fe)
ret = -1; info->fe = xzalloc(sizeof(*info->fe));
} else if (!info->fe)
ret = -1;
if (ret)
break; break;
ret = read_img_eof(img, info->fe); ret = read_img_eof(img, info->fe);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment