From bf1f711166bcf0051db346b06a90aad82bea3c45 Mon Sep 17 00:00:00 2001 From: antirez Date: Sun, 2 Feb 2020 18:17:45 +0100 Subject: [PATCH] When --ifile is used, read the file in a loop. --- dump1090.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dump1090.c b/dump1090.c index 6b25576..e8d0179 100644 --- a/dump1090.c +++ b/dump1090.c @@ -433,6 +433,15 @@ void readDataFromFile(void) { p = Modes.data+(MODES_FULL_LEN-1)*4; while(toread) { nread = read(Modes.fd, p, toread); + /* In --file mode, seek the file again from the start + * and re-play it. */ + if (nread == 0 && + Modes.filename != NULL && + Modes.fd != STDIN_FILENO) + { + if (lseek(Modes.fd,0,SEEK_SET) != -1) continue; + } + if (nread <= 0) { Modes.exit = 1; /* Signal the other thread to exit. */ break;