diff options
author | Skylar Chang <chiaweic@codeaurora.org> | 2014-06-25 21:35:17 -0700 |
---|---|---|
committer | Skylar Chang <chiaweic@codeaurora.org> | 2014-06-26 00:27:44 -0700 |
commit | 2eeab69c45cf242475f53f1072e7619cd6e829bb (patch) | |
tree | e98b37c5f5259febf2400cf305a3d69ab658e7c0 /ipacm/src/IPACM_Netlink.cpp | |
parent | 8d6de24b25568ce9bb5c06df5d1cb3ab6d36f9ca (diff) | |
download | ipacfg-mgr-2eeab69c45cf242475f53f1072e7619cd6e829bb.tar.gz |
IPACM: fix file descriptor issue
IPACM needs to open file descriptor and ioctl to
IPA-driver to install/remove the rules and it should
close all the file descriptor when it finished.
Change-Id: I72a11b705523a7122a6889641eb18b696dbc8c8b
Diffstat (limited to 'ipacm/src/IPACM_Netlink.cpp')
-rw-r--r-- | ipacm/src/IPACM_Netlink.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ipacm/src/IPACM_Netlink.cpp b/ipacm/src/IPACM_Netlink.cpp index d579952..9c616af 100644 --- a/ipacm/src/IPACM_Netlink.cpp +++ b/ipacm/src/IPACM_Netlink.cpp @@ -210,6 +210,11 @@ static int ipa_nl_sock_listener_start while(true) { + for(i = 0; i < sk_fd_set->num_fd; i++ ) + { + FD_SET(sk_fd_set->sk_fds[i].sk_fd, &(sk_fd_set->fdset)); + } + if((ret = select(sk_fd_set->max_fd + 1, &(sk_fd_set->fdset), NULL, NULL, NULL)) < 0) { IPACMERR("ipa_nl select failed\n"); @@ -230,6 +235,7 @@ static int ipa_nl_sock_listener_start i, sk_fd_set->sk_fds[i].sk_fd); } + FD_CLR(sk_fd_set->sk_fds[i].sk_fd, &(sk_fd_set->fdset)); } else { @@ -1595,6 +1601,7 @@ int ipa_nl_listener_init if(ipa_nl_addfd_map(sk_fdset, sk_info.sk_fd, read_f) != IPACM_SUCCESS) { IPACMERR("cannot add nl routing sock for reading\n"); + close(sk_info.sk_fd); return IPACM_FAILURE; } |