mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
registrybinary: Don't call fclose() more than once
We must not retry fclose() on EINTR as POSIX states: After the call to fclose(), any use of stream results in undefined behavior. We ensure above with fflush() and fsync() that everything is written out so chances of running into EINTR are very low. Nonetheless assume that the file can't be safely renamed, we'll just try again on the next opportunity. CID #1462697 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/465>
This commit is contained in:
parent
d854fb12e9
commit
0d1fe824e2
1 changed files with 9 additions and 4 deletions
|
@ -272,10 +272,15 @@ gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
|
|||
goto fsync_failed;
|
||||
}
|
||||
|
||||
/* close the file, even when unsuccessful, so not to leak a file descriptor */
|
||||
do {
|
||||
fclose_ret = fclose (cache->cache_file);
|
||||
} while (fclose_ret && errno == EINTR);
|
||||
/* close the file, even when unsuccessful, so not to leak a file descriptor.
|
||||
* We must not retry fclose() on EINTR as POSIX states:
|
||||
* After the call to fclose(), any use of stream results in undefined
|
||||
* behavior.
|
||||
* We ensure above with fflush() and fsync() that everything is written out
|
||||
* so chances of running into EINTR are very low. Nonetheless assume that
|
||||
* the file can't be safely renamed, we'll just try again on the next
|
||||
* opportunity. */
|
||||
fclose_ret = fclose (cache->cache_file);
|
||||
if (fclose_ret)
|
||||
goto fclose_failed;
|
||||
|
||||
|
|
Loading…
Reference in a new issue