When --ifile is used, read the file in a loop.

This commit is contained in:
antirez 2020-02-02 18:17:45 +01:00
parent 0b5a58832d
commit bf1f711166

View File

@ -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;