lseek() returns the offset if successful, and this is != 0 and
does not indicate an error. And if it does actually fail, don't
return FALSE (0) as an int, but -1. None of these things are
likely to have made a difference, ever. I don't think the offset
seek can ever actually happen, the current file position and the
current offset should always be increased in lock step, unless
there was an error in which case we'd just error out.
{
long written;
if (offset != cache->currentoffset) {
- if (lseek (cache->cache_fd, offset, SEEK_SET) != 0) {
- GST_ERROR ("Seeking to new offset failed");
- return FALSE;
+ if (lseek (cache->cache_fd, offset, SEEK_SET) < 0) {
+ GST_ERROR ("Seeking to new offset failed: %s", g_strerror (errno));
+ return -1;
}
+ GST_LOG ("Seeked from offset %lu to %lu", offset, cache->currentoffset);
cache->currentoffset = offset;
}