[][Change switch command to try ioctl first]

[Description]
Change switch command to try ioctl first.

[Release-log]
N/A

Change-Id: I75e34a8e621d3fc35ad39ff46cb12fb3b74c0577
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/4585296
diff --git a/feed/switch/src/switch_ioctl.c b/feed/switch/src/switch_ioctl.c
index 082eab1..094bfc7 100644
--- a/feed/switch/src/switch_ioctl.c
+++ b/feed/switch/src/switch_ioctl.c
@@ -2,6 +2,7 @@
  * switch_ioctl.c: switch(ioctl) set API
  */
 
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -15,13 +16,15 @@
 
 static int esw_fd;
 
-void switch_ioctl_init(void)
+int switch_ioctl_init(void)
 {
 	esw_fd = socket(AF_INET, SOCK_DGRAM, 0);
 	if (esw_fd < 0) {
 		perror("socket");
-		exit(0);
+		return -EINVAL;
 	}
+
+	return 0;
 }
 
 void switch_ioctl_fini(void)