registry: fix lseek() return code handling

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.
This commit is contained in:
Tim-Philipp Müller 2012-02-24 23:39:30 +00:00
parent c25b8e153d
commit 031514faeb

View file

@ -219,10 +219,11 @@ gst_registry_binary_cache_write (BinaryRegistryCache * cache,
{
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;
}