diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-11-05 09:18:43 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-11-05 09:18:43 +0000 |
commit | e57bf90ebeb17863f005f82009771510bb8b7362 (patch) | |
tree | 7067e0bc4fdb41911da0e3e653caf6a18c77c18e /epan/addr_resolv.c | |
parent | dc284b0c0492ed87a4e7d9bf83705d76f042b6e3 (diff) |
From Bill Parker:
code fails to check/test return value from select()
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7861
svn path=/trunk/; revision=45917
Diffstat (limited to 'epan/addr_resolv.c')
-rw-r--r-- | epan/addr_resolv.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index 7cd41504c3..76c0ea4ec9 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -2560,7 +2560,10 @@ host_name_lookup_process(void) { FD_ZERO(&wfds); nfds = ares_fds(ghba_chan, &rfds, &wfds); if (nfds > 0) { - select(nfds, &rfds, &wfds, NULL, &tv); + if (select(nfds, &rfds, &wfds, NULL, &tv) == -1) { /* call to select() failed */ + fprintf(stderr, "Warning: call to select() failed, error is %s\n", strerror(errno)); + return nro; + } ares_process(ghba_chan, &rfds, &wfds); } @@ -3276,7 +3279,10 @@ get_host_ipaddr(const char *host, guint32 *addrp) nfds = ares_fds(ghbn_chan, &rfds, &wfds); if (nfds > 0) { tvp = ares_timeout(ghbn_chan, &tv, &tv); - select(nfds, &rfds, &wfds, NULL, tvp); + if (select(nfds, &rfds, &wfds, NULL, tvp) == -1) { /* call to select() failed */ + fprintf(stderr, "Warning: call to select() failed, error is %s\n", strerror(errno)); + return FALSE; + } ares_process(ghbn_chan, &rfds, &wfds); } ares_cancel(ghbn_chan); @@ -3360,7 +3366,10 @@ get_host_ipaddr6(const char *host, struct e_in6_addr *addrp) nfds = ares_fds(ghbn_chan, &rfds, &wfds); if (nfds > 0) { tvp = ares_timeout(ghbn_chan, &tv, &tv); - select(nfds, &rfds, &wfds, NULL, tvp); + if (select(nfds, &rfds, &wfds, NULL, tvp) == -1) { /* call to select() failed */ + fprintf(stderr, "Warning: call to select() failed, error is %s\n", strerror(errno)); + return FALSE; + } ares_process(ghbn_chan, &rfds, &wfds); } ares_cancel(ghbn_chan); |