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

Submitted by Cyrill Gorcunov on Sept. 19, 2018, 11:50 a.m.

Details

Message ID 20180919115036.12934-6-gorcunov@gmail.com
State Accepted
Series "tests: Add testing for unshare codes and tun rework"
Headers show

Commit Message

Cyrill Gorcunov Sept. 19, 2018, 11:50 a.m.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 test/zdtm/static/netns_sub.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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;