summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-24 11:27:11 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-24 11:27:11 -0400
commit4bf5e0bd3a766511cf273ffd7162af9f2f8e64fb (patch)
tree2290ffa965632d6a0ce304f7ffe95d68d93ae1ff /libgpsd_core.c
parent218fe292eb7f71239a035e6d99f7c2d5339d96df (diff)
downloadgpsd-4bf5e0bd3a766511cf273ffd7162af9f2f8e64fb.tar.gz
Properly free devices when select() sees bad fds for them.
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 4803ffa0..6ec08a4d 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -992,7 +992,8 @@ static void gpsd_error_model(struct gps_device_t *session,
#endif /* CHEAPFLOATS_ENABLE */
/*@ -mustdefine -compdef @*/
-int gpsd_await_data(/*@out@*/fd_set *rfds,
+int gpsd_await_data(/*@out@*/fd_set *rfds,
+ /*@out@*/fd_set *efds,
const int maxfd,
/*@in@*/fd_set *all_fds,
const int debug)
@@ -1003,9 +1004,7 @@ int gpsd_await_data(/*@out@*/fd_set *rfds,
struct timeval tv;
#endif /* COMPAT_SELECT */
-#ifdef EFDS
FD_ZERO(efds);
-#endif /* EFDS */
(void)memcpy((char *)rfds, (char *)all_fds, sizeof(fd_set));
gpsd_report(debug, LOG_RAW + 2, "select waits\n");
/*
@@ -1039,13 +1038,10 @@ int gpsd_await_data(/*@out@*/fd_set *rfds,
/*
* All we care about here is a cheap, fast, uninterruptible
* way to check if a file descriptor is valid.
- * FIXME: pass out error fds when we can do a library bump.
*/
if (FD_ISSET(fd, all_fds) && fcntl(fd, F_GETFL, 0) == -1) {
FD_CLR(fd, all_fds);
-#ifdef EFDS
FD_SET(fd, efds);
-#endif /* EFDS */
}
return AWAIT_NOT_READY;
} else {