android: Fix ioctl03 test for Android
Android has tun file at /dev/tun not /dev/net/tun
Bug: 31152331
Test: Test ioctl03 runs, passes on Android device
Change-Id: I2dc376626060b09a9eb39574006839cce461fb1e
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Reviewed-by: Steve Muckle <smuckle@google.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
(cherry picked from commit fac61b0de20c729bcb5f6b0ec4dacc112e747084)
diff --git a/testcases/kernel/syscalls/ioctl/ioctl03.c b/testcases/kernel/syscalls/ioctl/ioctl03.c
index b1b50ed..bf3107f 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl03.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl03.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) International Business Machines Corp., 2008
- * Copyright (c) Linux Test Project, 2017
+ * Copyright (c) Linux Test Project, 2017-2019
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -79,6 +79,11 @@
unsigned int features, i;
int netfd = open("/dev/net/tun", O_RDWR);
+
+ /* Android has tun at /dev/tun */
+ if (netfd == -1 && (errno == ENODEV || errno == ENOENT))
+ netfd = open("/dev/tun", O_RDWR);
+
if (netfd == -1) {
if (errno == ENODEV || errno == ENOENT)
tst_brk(TCONF, "TUN support is missing?");