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().
This commit is contained in:
Tim-Philipp Müller 2012-02-24 23:19:51 +00:00
parent 0e8a77f83d
commit c25b8e153d

View file

@ -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);