summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-08-14 17:09:38 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-08-14 17:09:38 +0000
commitb5a1749e742af9b1be39d4924dcf0d4952a57ade (patch)
tree9d9c2287c13270ccea1c22673a0fc63af9637023 /gpsd.c
parent7831c6cb09cd1d121532efd46f7523c0ad016db1 (diff)
downloadgpsd-b5a1749e742af9b1be39d4924dcf0d4952a57ade.tar.gz
Suppress garbage write on channel assignment.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gpsd.c b/gpsd.c
index 0a1a94c9..4611d3c8 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -801,11 +801,11 @@ static struct channel_t *assign_channel(struct subscriber_t *user,
*/
if (user->watcher == WATCH_OLDSTYLE && !user->tied) {
/*@ -sefparams @*/
- ignore_return(write(user->fd, "GPSD,F=", 7));
- ignore_return(write(user->fd,
- channel->device->gpsdata.gps_device,
- strlen(channel->device->gpsdata.gps_device)));
- ignore_return(write(user->fd, "\r\n", 2));
+ throttled_write(user, "GPSD,F=", 7);
+ throttled_write(user,
+ channel->device->gpsdata.gps_device,
+ strlen(channel->device->gpsdata.gps_device));
+ throttled_write(user, "\r\n", 2);
/*@ +sefparams @*/
}
#endif /* OLDSTYLE_ENABLE */
@@ -815,6 +815,7 @@ static struct channel_t *assign_channel(struct subscriber_t *user,
if (was_unassigned) {
char buf[NMEA_MAX];
+ buf[0] = '\0';
#ifdef OLDSTYLE_ENABLE
if (!newstyle(user) && user->watcher)
(void)snprintf(buf, sizeof(buf), "GPSD,X=%f,I=%s\r\n",
@@ -826,9 +827,9 @@ static struct channel_t *assign_channel(struct subscriber_t *user,
channel->device->gpsdata.gps_device,
timestamp());
#endif /* GPSDNG_ENABLE */
-
/*@ -sefparams +matchanyintegral @*/
- ignore_return(write(user->fd, buf, strlen(buf)));
+ if (buf[0])
+ throttled_write(user, buf, strlen(buf));
/*@ +sefparams -matchanyintegral @*/
}