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.
This commit is contained in:
Michael Ossmann
2022-09-23 06:40:14 -04:00
parent 8fbaf1336c
commit 45504ff397

View File

@ -543,7 +543,7 @@ int tx_callback(hackrf_transfer* transfer)
}
/* Otherwise, the file ran short. If not repeating, this is the last data. */
if (!repeat) {
if ((!repeat) || (ftell(file) < 1)) {
tx_complete = true;
return 0;
}