summaryrefslogtreecommitdiff
path: root/gpsctl.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-18 01:48:48 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-18 01:49:51 -0400
commit117b8c2fcc577ec6eb1730fb554c91ab081f2cf5 (patch)
treeae90c19d647ee2a1f54d140968869f786b086a88 /gpsctl.c
parentb936bbc26412a1666c5bf8659c220dfaa158bd55 (diff)
downloadgpsd-117b8c2fcc577ec6eb1730fb554c91ab081f2cf5.tar.gz
Attempt to recover from EBADF in the main select.
All regression tests pass.
Diffstat (limited to 'gpsctl.c')
-rw-r--r--gpsctl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gpsctl.c b/gpsctl.c
index cf1d0433..744bec4c 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -664,11 +664,19 @@ int main(int argc, char **argv)
/* grab packets until we time out, get sync, or fail sync */
for (hunting = true; hunting; )
{
+#ifdef EFDS
+ fd_set efds;
+#endif /* EFDS */
switch(gpsd_await_data(&rfds, maxfd, &all_fds, context.debug))
{
case AWAIT_GOT_INPUT:
break;
case AWAIT_NOT_READY:
+#ifdef EFDS
+ /* no recovery from bad fd is possible */
+ if (FD_ISSET(session.gpsdata.gps_fd, &efds))
+ exit(EXIT_FAILURE);
+#endif /* EFDS */
continue;
case AWAIT_FAILED:
exit(EXIT_FAILURE);