summaryrefslogtreecommitdiffstats
path: root/core/qt-ble.cpp
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2018-10-06 10:17:06 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-06 19:38:14 -0700
commitebee0c4c24e3b2a327c6b7275093690d2bff66bb (patch)
treeaf8bdbdbe1be7f0966f1dce5af89bb301c6ddbce /core/qt-ble.cpp
parent432a324756040b1ef164edfe51b06133f66d1aa3 (diff)
downloadsubsurface-ebee0c4c24e3b2a327c6b7275093690d2bff66bb.tar.gz
Fix error handling for libdivecomputer import
The error handling was incorrect for the case where we successfully opened the libdivecomputer iostream in divecomputer_device_open(), but the dc_device_open() call failed. When the dc_device_open() failed, we would (correctly) not do the dc_device_close() but we would _also_ not do the dc_iostream_close() to close the underlying file descriptor, which is wrong. Normally this isn't all that noticeable, partly because the common case is that dc_device_open() succeeds if you actually do have a dive computer connected, but also because most of the time it just leaked a file descriptor or something like that. However, particularly for the POSIX serial device case, libdivecomputer does a ioctl(device->fd, TIOCEXCL, NULL) call to make serial opens exclusive. This is what we want - but if we then fail at closing the serial file descriptor, we won't be able to retry the import at all because now the next open will fail with EBUSY. So the error handling was incorrect, and while it doesn't usually matter all that much, it can be quite noticeable particularly when you have transient errors. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/qt-ble.cpp')
0 files changed, 0 insertions, 0 deletions