mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
downloadbuffer: close file before trying to remove
On Windows, the file handles must be closed before you can delete a file. Also, it would cause an error if you try to close an already closed handle. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/814>
This commit is contained in:
parent
135f517ea3
commit
c71805c565
1 changed files with 5 additions and 3 deletions
|
@ -963,15 +963,17 @@ gst_download_buffer_close_temp_location_file (GstDownloadBuffer * dlbuf)
|
|||
|
||||
GST_DEBUG_OBJECT (dlbuf, "closing sparse file");
|
||||
|
||||
gst_sparse_file_free (dlbuf->file);
|
||||
dlbuf->file = NULL;
|
||||
/* fd was closed by gst_sparse_file_free's fclose() */
|
||||
dlbuf->temp_fd = -1;
|
||||
|
||||
if (dlbuf->temp_remove) {
|
||||
if (remove (dlbuf->temp_location) < 0) {
|
||||
GST_WARNING_OBJECT (dlbuf, "Failed to remove temporary file %s: %s",
|
||||
dlbuf->temp_location, g_strerror (errno));
|
||||
}
|
||||
}
|
||||
gst_sparse_file_free (dlbuf->file);
|
||||
close (dlbuf->temp_fd);
|
||||
dlbuf->file = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue