diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2007-06-01 19:23:17 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2007-06-01 19:23:17 +0000 |
commit | 434aa4709368135fa7ef330c6f968c3ab59408c5 (patch) | |
tree | f9897b18ea769882a788d08d376a3a3e0a28153b /serial.c | |
parent | 935c33d4c9469fa406925635b2084f0b44673a1d (diff) | |
download | gpsd-434aa4709368135fa7ef330c6f968c3ab59408c5.tar.gz |
Change return ttype of gpsd_write to be what the Garmin driver was expecting;
it actually makes more sense this way. (Fixes what may have been a
subtle bug.)
Diffstat (limited to 'serial.c')
-rw-r--r-- | serial.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -201,16 +201,16 @@ void gpsd_set_speed(struct gps_device_t *session, int gpsd_open(struct gps_device_t *session) { struct stat sb; - mode_t mode = O_RDWR; + mode_t mode = (mode_t)O_RDWR; if (device_readonly || ((stat(session->gpsdata.gps_device, &sb) != -1) && ((sb.st_mode & S_IFCHR) != S_IFCHR))){ - mode = O_RDONLY; + mode = (mode_t)O_RDONLY; gpsd_report(LOG_INF, "opening read-only GPS data source at '%s'\n", session->gpsdata.gps_device); } else { gpsd_report(LOG_INF, "opening GPS data source at '%s'\n", session->gpsdata.gps_device); } - if ((session->gpsdata.gps_fd = open(session->gpsdata.gps_device, mode|O_NONBLOCK|O_NOCTTY)) < 0) { + if ((session->gpsdata.gps_fd = open(session->gpsdata.gps_device, (int)(mode|O_NONBLOCK|O_NOCTTY))) < 0) { gpsd_report(LOG_ERROR, "device open failed: %s - retrying read-only\n", strerror(errno)); if ((session->gpsdata.gps_fd = open(session->gpsdata.gps_device, O_RDONLY|O_NONBLOCK|O_NOCTTY)) < 0) { gpsd_report(LOG_ERROR, "read-only device open failed: %s\n", strerror(errno)); @@ -260,7 +260,7 @@ int gpsd_open(struct gps_device_t *session) return session->gpsdata.gps_fd; } -bool gpsd_write(struct gps_device_t *session, void const *buf, size_t len) +ssize_t gpsd_write(struct gps_device_t *session, void const *buf, size_t len) { ssize_t status; bool ok; @@ -271,7 +271,7 @@ bool gpsd_write(struct gps_device_t *session, void const *buf, size_t len) (void)tcdrain(session->gpsdata.gps_fd); /* no test here now, always print as hex */ gpsd_report(LOG_IO, "=> GPS: %s%s\n", gpsd_hexdump(buf, len), ok?"":" FAILED"); - return ok; + return status; } /* |