mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
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:
parent
0e8a77f83d
commit
c25b8e153d
1 changed files with 7 additions and 6 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue