[CRIU] [PATCH 2/2] crtools: fix backward compatibility

Andrey Vagin avagin at openvz.org
Fri Jan 11 00:56:42 EST 2013


crtools should not failed, if new images are absent.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 signalfd.c  | 7 ++++++-
 sk-packet.c | 7 ++++++-
 tty.c       | 2 ++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/signalfd.c b/signalfd.c
index c8dc77f..eeaef9f 100644
--- a/signalfd.c
+++ b/signalfd.c
@@ -129,6 +129,11 @@ static int collect_one_sigfd(void *o, ProtobufCMessage *msg)
 
 int collect_signalfd(void)
 {
-	return collect_image(CR_FD_SIGNALFD, PB_SIGNALFD,
+	int ret = collect_image(CR_FD_SIGNALFD, PB_SIGNALFD,
 			sizeof(struct signalfd_info), collect_one_sigfd);
+
+	if (ret < 0 && errno == ENOENT)
+		return 0;
+
+	return ret;
 }
diff --git a/sk-packet.c b/sk-packet.c
index db938dd..9b667c4 100644
--- a/sk-packet.c
+++ b/sk-packet.c
@@ -497,6 +497,11 @@ static int collect_one_packet_sk(void *o, ProtobufCMessage *base)
 
 int collect_packet_sockets(void)
 {
-	return collect_image(CR_FD_PACKETSK, PB_PACKETSK,
+	int ret = collect_image(CR_FD_PACKETSK, PB_PACKETSK,
 			sizeof(struct packet_sock_info), collect_one_packet_sk);
+
+	if (ret < 0 && errno == ENOENT)
+		return 0;
+
+	return ret;
 }
diff --git a/tty.c b/tty.c
index 0daa530..5a78a0f 100644
--- a/tty.c
+++ b/tty.c
@@ -971,6 +971,8 @@ int collect_tty(void)
 	ret = collect_image(CR_FD_TTY_INFO, PB_TTY_INFO,
 			    sizeof(struct tty_info_entry),
 			    collect_one_tty_info_entry);
+	if (ret && errno == ENOENT)
+		return 0;
 	if (!ret)
 		ret = collect_image(CR_FD_TTY, PB_TTY,
 				sizeof(struct tty_info),
-- 
1.7.11.7



More information about the CRIU mailing list