[CRIU] [PATCH 1/2] service_fd: Check install_service_fd() return value in open_image_dir()

Kirill Tkhai ktkhai at virtuozzo.com
Wed Mar 22 04:05:38 PDT 2017


Of course, install_service_fd() may fail. So, check its return value.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/image.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/criu/image.c b/criu/image.c
index 02cc45a69..87715fdf9 100644
--- a/criu/image.c
+++ b/criu/image.c
@@ -476,6 +476,11 @@ int open_image_dir(char *dir)
 	}
 
 	ret = install_service_fd(IMG_FD_OFF, fd);
+	if (ret < 0) {
+		pr_err("Can't install service fd\n");
+		close(fd);
+		return -1;
+	}
 	close(fd);
 	fd = ret;
 



More information about the CRIU mailing list