From 031514faebdcaeb05e6c6625d6152f122af1ed6e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 24 Feb 2012 23:39:30 +0000 Subject: [PATCH] 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. --- gst/gstregistrybinary.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c index 7cd148e..5848066 100644 --- a/gst/gstregistrybinary.c +++ b/gst/gstregistrybinary.c @@ -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; } -- 2.7.4