summaryrefslogtreecommitdiff
path: root/gpsmon.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 /gpsmon.c
parentb936bbc26412a1666c5bf8659c220dfaa158bd55 (diff)
downloadgpsd-117b8c2fcc577ec6eb1730fb554c91ab081f2cf5.tar.gz
Attempt to recover from EBADF in the main select.
All regression tests pass.
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gpsmon.c b/gpsmon.c
index 77b65582..02a2c1cb 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -1258,11 +1258,19 @@ int main(int argc, char **argv)
for (;;)
{
+#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))
+ longjmp(terminate, TERM_SELECT_FAILED);
+#endif /* EFDS */
continue;
case AWAIT_FAILED:
longjmp(terminate, TERM_SELECT_FAILED);