gstreamer: registry: fix lseek() return code handling
Tim Müller
tpm at kemper.freedesktop.org
Fri Feb 24 16:05:40 PST 2012
Module: gstreamer
Branch: master
Commit: 031514faebdcaeb05e6c6625d6152f122af1ed6e
URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=031514faebdcaeb05e6c6625d6152f122af1ed6e
Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date: Fri Feb 24 23:39:30 2012 +0000
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 files 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;
}
More information about the gstreamer-commits
mailing list