diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-03-13 10:06:06 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-14 11:34:46 -0700 |
commit | 4ee4bbdb58d7dabae1be1fa6e62622caa5a4fcbc (patch) | |
tree | fa0d0a6e2812232414ea4557bb91da3f114b00ee /android | |
parent | 0acfa28d873ded8b87a5b64cc8e13aca5c6b34a3 (diff) | |
download | subsurface-4ee4bbdb58d7dabae1be1fa6e62622caa5a4fcbc.tar.gz |
iostream: fix incorrect rfcomm error case when reading
We had two independent bugs here, both of which needed to fire for this
to cause a problem. This fixes both of them.
The first bug was that our rfcomm code would return DC_STATUS_SUCCESS
with a zero-sized read when a timeout happened, or when the rfcomm
socket had disconnected. That makes absolutely no sense. We should
return DC_STATUS_TIMEOUT on timeout, and DC_STATUS_IO if the socket has
disconnected without any data.
The fix to this is to make the whole rfcomm iostream read logic much
simpler: there's no need to loop at all for partial results, because the
libdivecomputer iostream side will do the loop for us (and handle
partial results much better: it knows if the target backend can handle
those partial results or not).
The second bug was in our libdivecomputer iostream read() function,
which reacted very badly to this bad return value. This updates our
libdivecomputer branch to one that is more careful about things.
Reported-by: linuxcrash <albin@mrty.ch>
Debugged-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'android')
0 files changed, 0 insertions, 0 deletions