[CRIU] [PATCH] tun/kerndat: Keep going with CONFIG_TUN=n

Dmitry Safonov dima at arista.com
Thu Jun 14 01:57:13 MSK 2018


check_tun_netns_cr() should return 0 on CONFIG_TUN=n kernels.
That is, when we fail to open tun device.

Fixes: #496

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 criu/tun.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/criu/tun.c b/criu/tun.c
index 8274ccb8d71b..c1dabaf37d96 100644
--- a/criu/tun.c
+++ b/criu/tun.c
@@ -74,17 +74,18 @@ int check_tun_cr(int no_tun_err)
 
 int check_tun_netns_cr(bool *result)
 {
-	bool val;
+	bool val = false;
 	int tun;
 
 	tun = open(TUN_DEV_GEN_PATH, O_RDONLY);
 	if (tun < 0) {
 		pr_perror("Unable to create tun");
-		return -1;
+		goto out;
 	}
 	check_has_netns_ioc(tun, &val, "tun");
 	close(tun);
 
+out:
 	if (result)
 		*result = val;
 
-- 
2.13.6



More information about the CRIU mailing list