[CRIU] [PATCH 4/7] sfd: Don't proceed if clone_service_fd failed

Cyrill Gorcunov gorcunov at openvz.org
Mon May 29 13:15:02 PDT 2017


From: Cyrill Gorcunov <gorcunov at virtuozzo.com>

In case if clone_service_fd is failed we should not
continue restore procedure but exit with error.

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 criu/util.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/criu/util.c b/criu/util.c
index 46273ee9a0cd..34a3acf76531 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -504,13 +504,16 @@ int clone_service_fd(int id)
 
 		if (old < 0)
 			continue;
-		if (!may_install_service_fd(new))
-			pr_err("sfd %d/%d is busy\n", new, i);
+		if (!may_install_service_fd(new)) {
+			pr_err("sfd %d/%d is busy (cloning)\n", new, i);
+			return -1;
+		}
 		ret = dup2(old, new);
 		if (ret == -1) {
 			if (errno == EBADF)
 				continue;
 			pr_perror("Unable to clone %d->%d", old, new);
+			return -1;
 		}
 	}
 
-- 
2.7.4



More information about the CRIU mailing list