commit | 0c1ae57e4d29255555ca411a10527f334f006482 | [log] [tgz] |
---|---|---|
author | developer <developer@mediatek.com> | Thu May 27 15:32:01 2021 +0800 |
committer | developer <developer@mediatek.com> | Fri May 28 17:23:21 2021 +0800 |
tree | 4de5d48b602b2b33e48486f3efa72b0f63c884f8 | |
parent | 3e91642854f153e07cf4875017f285214ef693c3 [diff] [blame] |
[][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)