summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gpsctl.c11
-rw-r--r--gpsd.c10
-rw-r--r--gpsd.h-tail6
-rw-r--r--gpsmon.c11
-rw-r--r--libgpsd_core.c8
5 files changed, 38 insertions, 8 deletions
diff --git a/gpsctl.c b/gpsctl.c
index b3ed29a1..35b8922b 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -654,6 +654,17 @@ int main(int argc, char **argv)
/* grab packets until we time out or get sync */
for (hunting = true; hunting; )
{
+ switch(gpsd_await_data(&rfds, maxfd, &all_fds, context.debug))
+ {
+ case AWAIT_GOT_INPUT:
+ break;
+ case AWAIT_NOT_READY:
+ continue;
+ case AWAIT_FAILED:
+ exit(EXIT_FAILURE);
+ break;
+ }
+
if (!gpsd_await_data(&rfds, maxfd, &all_fds, context.debug))
continue;
diff --git a/gpsd.c b/gpsd.c
index 52ca6d75..c87fd461 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -2123,8 +2123,16 @@ int main(int argc, char *argv[])
}
while (0 == signalled) {
- if (!gpsd_await_data(&rfds, maxfd, &all_fds, context.debug))
+ switch(gpsd_await_data(&rfds, maxfd, &all_fds, context.debug))
+ {
+ case AWAIT_GOT_INPUT:
+ break;
+ case AWAIT_NOT_READY:
continue;
+ case AWAIT_FAILED:
+ exit(EXIT_FAILURE);
+ break;
+ }
#ifdef SOCKET_EXPORT_ENABLE
/* always be open to new client connections */
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 7b1804fc..a866f69f 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -826,7 +826,11 @@ extern int gpsd_open(struct gps_device_t *);
#define O_OPTIMIZE 2
extern int gpsd_activate(struct gps_device_t *, const int);
extern void gpsd_deactivate(struct gps_device_t *);
-extern bool gpsd_await_data(/*@out@*/fd_set *,
+
+#define AWAIT_GOT_INPUT 1
+#define AWAIT_NOT_READY 0
+#define AWAIT_FAILED -1
+extern int gpsd_await_data(/*@out@*/fd_set *,
const int,
/*@in@*/fd_set *,
const int);
diff --git a/gpsmon.c b/gpsmon.c
index b2781a53..2c194612 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -1011,9 +1011,16 @@ int main(int argc, char **argv)
if ((bailout = setjmp(terminate)) == 0) {
for (;;)
{
- /* FIXME: On non-EINTR select failure, throw TERM_SELECT_FAILED */
- if (!gpsd_await_data(&rfds, maxfd, &all_fds, context.debug))
+ switch(gpsd_await_data(&rfds, maxfd, &all_fds, context.debug))
+ {
+ case AWAIT_GOT_INPUT:
+ break;
+ case AWAIT_NOT_READY:
continue;
+ case AWAIT_FAILED:
+ longjmp(terminate, TERM_SELECT_FAILED);
+ break;
+ }
switch(gpsd_multipoll(FD_ISSET(session.gpsdata.gps_fd, &rfds),
&session, monhook, 0))
diff --git a/libgpsd_core.c b/libgpsd_core.c
index f7baaf38..da1d7256 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -966,7 +966,7 @@ static void gpsd_error_model(struct gps_device_t *session,
#endif /* CHEAPFLOATS_ENABLE */
/*@ -mustdefine -compdef @*/
-bool gpsd_await_data(/*@out@*/fd_set *rfds,
+int gpsd_await_data(/*@out@*/fd_set *rfds,
const int maxfd,
/*@in@*/fd_set *all_fds,
const int debug)
@@ -1003,9 +1003,9 @@ bool gpsd_await_data(/*@out@*/fd_set *rfds,
#endif
if (status == -1) {
if (errno == EINTR)
- return false;
+ return AWAIT_NOT_READY;
gpsd_report(debug, LOG_ERROR, "select: %s\n", strerror(errno));
- exit(EXIT_FAILURE);
+ return AWAIT_FAILED;
}
/*@ +usedef +nullpass @*/
@@ -1028,7 +1028,7 @@ bool gpsd_await_data(/*@out@*/fd_set *rfds,
dbuf, timestamp(), errno);
}
- return true;
+ return AWAIT_GOT_INPUT;
}
/*@ +mustdefine +compdef @*/