summaryrefslogtreecommitdiff
path: root/net_gnss_dispatch.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-14 12:01:28 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-14 12:01:28 -0400
commitc2c6bbd8286932e8ceb03cd57f1b24d0e105e36c (patch)
treed93d3986bb7d633c0caa87c487d09db6d9d6728d /net_gnss_dispatch.c
parent725487a5e9d1c01a99606f42d533bc7069a184a5 (diff)
downloadgpsd-c2c6bbd8286932e8ceb03cd57f1b24d0e105e36c.tar.gz
Type cleanup: rtcmbyyes should bre a size_t.
All regressions pass. All splint chexcks pass.
Diffstat (limited to 'net_gnss_dispatch.c')
-rw-r--r--net_gnss_dispatch.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net_gnss_dispatch.c b/net_gnss_dispatch.c
index fb1e6a81..6a6bee85 100644
--- a/net_gnss_dispatch.c
+++ b/net_gnss_dispatch.c
@@ -61,15 +61,17 @@ int netgnss_poll(struct gps_context_t *context)
/* poll the DGNSS service for a correction report */
{
if (context->dsock > -1) {
- context->rtcmbytes =
+ ssize_t rtcmbytes =
read(context->dsock, context->rtcmbuf, sizeof(context->rtcmbuf));
- if ((context->rtcmbytes == -1 && errno != EAGAIN)
- || (context->rtcmbytes == 0)) {
+ if ((rtcmbytes == -1 && errno != EAGAIN) || (rtcmbytes == 0)) {
(void)shutdown(context->dsock, SHUT_RDWR);
(void)close(context->dsock);
+ context->rtcmbytes = 0;
return -1;
- } else
+ } else {
+ context->rtcmbytes = (size_t)rtcmbytes;
context->rtcmtime = timestamp();
+ }
}
return 0;
}
@@ -97,7 +99,7 @@ void rtcm_relay(struct gps_device_t *session)
/* pass a DGNSS connection report to a session */
{
if (session->gpsdata.gps_fd != -1
- && session->context->rtcmbytes > -1
+ && session->context->rtcmbytes > 0
&& session->rtcmtime < session->context->rtcmtime
&& session->device_type->rtcm_writer != NULL) {
if (session->device_type->rtcm_writer(session,