diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-12-03 00:18:22 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-12-03 00:18:22 -0500 |
commit | 28ff7510067a5609bc6eec1c4f9ec178488dadf5 (patch) | |
tree | 044494429aaa66006865cac014c81394adefd039 /gpspipe.c | |
parent | 07c982702b1fdcf79d24d4411a71297595c0d14b (diff) | |
download | gpsd-28ff7510067a5609bc6eec1c4f9ec178488dadf5.tar.gz |
Attempt to address #17564: gpspipe terminates because of non-blocking socket.
Diffstat (limited to 'gpspipe.c')
-rw-r--r-- | gpspipe.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -316,6 +316,7 @@ int main(int argc, char **argv) spinner(vflag, l++); /* reading directly from the socket avoids decode overhead */ + errno = 0; readbytes = (int)read(gpsdata.gps_fd, buf, sizeof(buf)); if (readbytes > 0) { for (i = 0; i < readbytes; i++) { @@ -371,7 +372,10 @@ int main(int argc, char **argv) } } else { if (readbytes == -1) { - (void)fprintf(stderr, "gpspipe: read error %s(%d)\n", + if (errno == EAGAIN) + continue; + else + (void)fprintf(stderr, "gpspipe: read error %s(%d)\n", strerror(errno), errno); exit(1); } else { |