diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-11-01 10:07:47 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-11-01 10:07:47 -0400 |
commit | b99aade97201c7eee4e1f96d59c1b729e238478c (patch) | |
tree | ecbaeea6a4202e226f3ed857906f3e91afc3c542 /libgps_shm.c | |
parent | 00838740621c132a62df448802d25f7ef2ab23f3 (diff) | |
download | gpsd-b99aade97201c7eee4e1f96d59c1b729e238478c.tar.gz |
Fix hang bug in the SHM client code. Thanks to Michael Tatarinov.
This has been broken for two years and nobody noticed!
Diffstat (limited to 'libgps_shm.c')
-rw-r--r-- | libgps_shm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libgps_shm.c b/libgps_shm.c index 6bedffe8..f25a07e4 100644 --- a/libgps_shm.c +++ b/libgps_shm.c @@ -67,7 +67,7 @@ int gps_shm_open(/*@out@*/struct gps_data_t *gpsdata) } bool gps_shm_waiting(const struct gps_data_t *gpsdata, int timeout) -/* check to see if new dayta has been written */ +/* check to see if new data has been written */ { volatile struct shmexport_t *shared = (struct shmexport_t *)PRIVATE(gpsdata)->shmseg; bool newdata; @@ -77,7 +77,7 @@ bool gps_shm_waiting(const struct gps_data_t *gpsdata, int timeout) for (;;) { newdata = false; barrier(); - if (shared->bookend1 == shared->bookend2 && shared->bookend1 > PRIVATE(gpsdata)->tick + timeout) + if (shared->bookend1 == shared->bookend2 && shared->bookend1 > PRIVATE(gpsdata)->tick) newdata = true; barrier(); if (newdata || (timestamp() - basetime >= (double)timeout)) |