diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-04-21 03:14:03 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-04-21 03:14:03 +0000 |
commit | 75002d5d3213992033888256a8671a7c8133db75 (patch) | |
tree | 11d4d28c7eb5af7f78bca6e5da18097fdae749ce /libgps.c | |
parent | 658b09195bb9ace363edf942992b0e934ef6aa21 (diff) | |
download | gpsd-75002d5d3213992033888256a8671a7c8133db75.tar.gz |
Make sure gps_poll() will return -1 on a zero read
The idea is to suggest a dropped connection.
Diffstat (limited to 'libgps.c')
-rw-r--r-- | libgps.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -437,12 +437,9 @@ int gps_poll(struct gps_data_t *gpsdata) /* the daemon makes sure that every read is NUL-terminated */ n = read(gpsdata->gps_fd, buf, sizeof(buf)-1); - if (n < 0) { - /* error */ + if (n <= 0) { + /* error or nothiung read */ return -1; - } else if ( n == 0 ) { - /* nothing read */ - return 0; } buf[n] = '\0'; |