summaryrefslogtreecommitdiff
path: root/dgpsip.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2008-12-29 22:12:38 +0000
committerEric S. Raymond <esr@thyrsus.com>2008-12-29 22:12:38 +0000
commit24d0602c05ff825565537a853c3f339ec2df6adc (patch)
tree51b4ea26c153a5ab8ab801c76a8315869e8899c4 /dgpsip.c
parentc806659782602b1cef904957d63924f0b167c25e (diff)
downloadgpsd-24d0602c05ff825565537a853c3f339ec2df6adc.tar.gz
GCC now gets huffy about unchecked write(2) returns. Fix some of these.
Diffstat (limited to 'dgpsip.c')
-rw-r--r--dgpsip.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/dgpsip.c b/dgpsip.c
index 6383a548..2da757eb 100644
--- a/dgpsip.c
+++ b/dgpsip.c
@@ -35,8 +35,10 @@ int dgpsip_open(struct gps_context_t *context, const char *dgpsserver)
(void)gethostname(hn, sizeof(hn));
/* greeting required by some RTCM104 servers; others will ignore it */
(void)snprintf(buf,sizeof(buf), "HELO %s gpsd %s\r\nR\r\n",hn,VERSION);
- (void)write(context->dsock, buf, strlen(buf));
- context->dgnss_service = dgnss_dgpsip;
+ if (write(context->dsock, buf, strlen(buf)) == strlen(buf))
+ context->dgnss_service = dgnss_dgpsip;
+ else
+ gpsd_report(LOG_ERROR, "hello to DGPS server %s failed\n", dgpsserver);
} else
gpsd_report(LOG_ERROR, "can't connect to DGPS server %s, netlib error %d.\n", dgpsserver, context->dsock);
opts = fcntl(context->dsock, F_GETFL);
@@ -62,8 +64,10 @@ void dgpsip_report(struct gps_device_t *session)
session->gpsdata.fix.latitude,
session->gpsdata.fix.longitude,
session->gpsdata.fix.altitude);
- (void)write(session->context->dsock, buf, strlen(buf));
- gpsd_report(LOG_IO, "=> dgps %s", buf);
+ if (write(session->context->dsock, buf, strlen(buf)) == strlen(buf))
+ gpsd_report(LOG_IO, "=> dgps %s", buf);
+ else
+ gpsd_report(LOG_IO, "write to dgps FAILED");
}
}
}