summaryrefslogtreecommitdiff
path: root/main/media_cache.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-02-28 14:48:51 -0500
committerSean Bright <sean.bright@gmail.com>2017-02-28 16:09:54 -0600
commit60e9e4fcc0ac340c0bfde1e1ade30e07951e9351 (patch)
tree4b69af637f6d1d689c7e1c15077e3b74004f04d1 /main/media_cache.c
parent0986998f2fddb4ec79bcc641798183be846d0d14 (diff)
media_cache: Mark cache entry stale if cache file is removed
In the event that a cache file is removed out from under us, we should treat the cache entry as stale and force a refresh. ASTERISK-26774 #close Reported by: Igor Gamayunov Change-Id: I3b1bd0c999d59d18664ef73a29823bc5b431dc52
Diffstat (limited to 'main/media_cache.c')
-rw-r--r--main/media_cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main/media_cache.c b/main/media_cache.c
index 7be358879..2592f353a 100644
--- a/main/media_cache.c
+++ b/main/media_cache.c
@@ -224,7 +224,8 @@ int ast_media_cache_retrieve(const char *uri, const char *preferred_file_name,
*/
bucket_file = ao2_find(media_cache, uri, OBJ_SEARCH_KEY | OBJ_NOLOCK);
if (bucket_file) {
- if (!ast_bucket_file_is_stale(bucket_file)) {
+ if (!ast_bucket_file_is_stale(bucket_file)
+ && !access(bucket_file->path, R_OK)) {
ast_copy_string(file_path, bucket_file->path, len);
if ((ext = strrchr(file_path, '.'))) {
*ext = '\0';