[08/10] test: static/tun -- Check if unshare successed

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

Details

Message ID 20180919115036.12934-9-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/tun.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/test/zdtm/static/tun.c b/test/zdtm/static/tun.c
index 98519e5d22cf..c38ac4836e6d 100644
--- a/test/zdtm/static/tun.c
+++ b/test/zdtm/static/tun.c
@@ -120,7 +120,10 @@  int main(int argc, char **argv)
 
 	test_init(argc, argv);
 #ifdef TUN_NS
-	unshare(CLONE_NEWNET);
+	if (unshare(CLONE_NEWNET)) {
+		pr_perror("unshare");
+		return 1;
+	}
 	system("ip link set up dev lo");
 #endif
 	/* fd[0] -- opened file */