gstreamer: registry: don' t forget to clean up registry temp file in another error case
Tim Müller
tpm at kemper.freedesktop.org
Fri Feb 24 16:05:40 PST 2012
Module: gstreamer
Branch: master
Commit: c25b8e153d4515b42f9e522de8655460d5cde1dc
URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=c25b8e153d4515b42f9e522de8655460d5cde1dc
Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date: Fri Feb 24 23:19:51 2012 +0000
registry: don't forget to clean up registry temp file in another error case
Also clean up temp file if we get an error during write() rather
than just when doing fsync() or close().
---
gst/gstregistrybinary.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c
index 1a58837..7cd148e 100644
--- a/gst/gstregistrybinary.c
+++ b/gst/gstregistrybinary.c
@@ -245,12 +245,13 @@ gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
if (close (cache->cache_fd) < 0)
goto close_failed;
- if (success) {
- /* Only do the rename if we wrote the entire file successfully */
- if (g_rename (cache->tmp_location, cache->location) < 0) {
- GST_ERROR ("g_rename() failed: %s", g_strerror (errno));
- goto rename_failed;
- }
+ if (!success)
+ goto fail_after_close;
+
+ /* Only do the rename if we wrote the entire file successfully */
+ if (g_rename (cache->tmp_location, cache->location) < 0) {
+ GST_ERROR ("g_rename() failed: %s", g_strerror (errno));
+ goto rename_failed;
}
g_free (cache->tmp_location);
More information about the gstreamer-commits
mailing list