fix edge-case where bytes_to_read is equal to length of bytes read

rtlsdr_callback would never set do_exit if the length of data read was exactly equal to the remaining bytes_to_read: the first if-block would fail the bytes_to_read < len, but the latter check would decrement bytes_to_read to 0, which would then never subsequently trigger the first block.
This commit is contained in:
Matt Panaro 2017-10-18 18:26:03 -04:00 committed by Benjamin Larsson
parent 8ad23ce933
commit 86898f16dd

View file

@ -605,7 +605,7 @@ static void rtlsdr_callback(unsigned char *iq_buf, uint32_t len, void *ctx) {
if (do_exit || do_exit_async)
return;
if ((bytes_to_read > 0) && (bytes_to_read < len)) {
if ((bytes_to_read > 0) && (bytes_to_read <= len)) {
len = bytes_to_read;
do_exit = 1;
rtlsdr_cancel_async(dev);