From 6c21e9d01f8169643de76a0342a1f49a52212cfc Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Sun, 25 Aug 2019 17:31:09 +0200 Subject: fl2k_file: check read return value before repeating In case of a FIFO that has been closed or a 0 byte file this will otherwise lead to an endless loop. --- src/fl2k_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fl2k_file.c b/src/fl2k_file.c index cff5178..80ddcad 100644 --- a/src/fl2k_file.c +++ b/src/fl2k_file.c @@ -95,7 +95,7 @@ void fl2k_callback(fl2k_data_info_t *data_info) fprintf(stderr, "File Error\n"); if (feof(file)) { - if (repeat) { + if (repeat && (r > 0)) { repeat_cnt++; fprintf(stderr, "repeat %d\n", repeat_cnt); rewind(file); -- cgit v1.2.3