Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 45504ff

Browse files
committed
Don't repeat file that can't advance its position.
This avoids a confusing condition when hackrf_transfer is reading from stdin with -R in which it does not repeat previous data but repeatedly restarts reading new data after the user types Ctrl-D to indicate EOF. The -R option should repeat previous data or should do nothing if the input file cannot be rewound.
1 parent 8fbaf13 commit 45504ff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

host/hackrf-tools/src/hackrf_transfer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ int tx_callback(hackrf_transfer* transfer)
543543
}
544544

545545
/* Otherwise, the file ran short. If not repeating, this is the last data. */
546-
if (!repeat) {
546+
if ((!repeat) || (ftell(file) < 1)) {
547547
tx_complete = true;
548548
return 0;
549549
}

0 commit comments

Comments
 (0)