timeshift: fix bug that can cause failure when seeking hits start of file

this resulted in a failed read that terminated the timeshift buffer.
This commit is contained in:
Adam Sutton 2013-02-22 11:11:10 +00:00
parent c54c91becd
commit 229a8d75d8

View file

@ -322,12 +322,10 @@ static int _timeshift_read
#endif
*fd = open((*cur_file)->path, O_RDONLY);
}
if (*cur_off) {
#ifdef TSHFT_TRACE
tvhlog(LOG_DEBUG, "timeshift", "ts %d seek to %lu", ts->id, *cur_off);
tvhlog(LOG_DEBUG, "timeshift", "ts %d seek to %lu", ts->id, *cur_off);
#endif
lseek(*fd, *cur_off, SEEK_SET);
}
lseek(*fd, *cur_off, SEEK_SET);
/* Read msg */
ssize_t r = _read_msg(*fd, sm);