[CRIU] [PATCH 05/10] test: static/netns_sub -- Check if unshare successed

Cyrill Gorcunov gorcunov at gmail.com
Wed Sep 19 14:50:31 MSK 2018


Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 test/zdtm/static/netns_sub.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/zdtm/static/netns_sub.c b/test/zdtm/static/netns_sub.c
index 8428bca74d89..6515057d8ad7 100644
--- a/test/zdtm/static/netns_sub.c
+++ b/test/zdtm/static/netns_sub.c
@@ -100,7 +100,10 @@ int main(int argc, char **argv)
 	}
 	if (pid1 == 0) {
 		close(sk);
-		unshare(CLONE_NEWNET);
+		if (unshare(CLONE_NEWNET)) {
+			pr_perror("unshare");
+			return 1;
+		}
 		sk = create_socket(1);
 		if (sk < 0)
 			return 1;
@@ -159,7 +162,10 @@ int main(int argc, char **argv)
 		return -1;
 	}
 	if (pid2 == 0) {
-		unshare(CLONE_NEWNET);
+		if (unshare(CLONE_NEWNET)) {
+			pr_perror("unshare");
+			return 1;
+		}
 		sk = create_socket(2);
 		if (sk < 0)
 			return 1;
-- 
2.17.1



More information about the CRIU mailing list