[CRIU] [PATCH @master] fifo: Fix bogus error reporting

Cyrill Gorcunov gorcunov at openvz.org
Tue Jul 10 05:02:13 EDT 2012


Sorry for inconvenience, I've missed this nit 'cause I've been
testing the whole PB bundle not the one patch in a row. Fix
enveloped.

	Cyrill
-------------- next part --------------
>From 3da71ed548543525518e60cf288479aa9e1bc4d1 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Tue, 10 Jul 2012 12:59:39 +0400
Subject: [PATCH] fifo: Fix bogus error reporting

ret occasionally set to -1 all the time
making fifo to fail.

Reported-by: Pavel Emelyanov <xemul at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 fifo.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fifo.c b/fifo.c
index fb48cf0..5f4e1ec 100644
--- a/fifo.c
+++ b/fifo.c
@@ -158,20 +158,20 @@ static int handle_fifo_data(void)
 int collect_fifo(void)
 {
 	struct fifo_info *info = NULL;
-	int img, ret = -1;
+	int img, ret;
 
 	img = open_image_ro(CR_FD_FIFO);
 	if (img < 0)
 		return -1;
 
 	while (1) {
+		ret = -1;
 		info = xzalloc(sizeof(*info));
 		if (info) {
 			info->fe = xzalloc(sizeof(*info->fe));
-			if (!info->fe)
-				ret = -1;
-		} else
-			ret = -1;
+			if (info->fe)
+				ret = 0;
+		}
 
 		if (ret)
 			break;
-- 
1.7.7.6



More information about the CRIU mailing list