summaryrefslogtreecommitdiffstats
path: root/stream/cache_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/cache_file.c')
-rw-r--r--stream/cache_file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/stream/cache_file.c b/stream/cache_file.c
index af315b355a..7ecc0f9858 100644
--- a/stream/cache_file.c
+++ b/stream/cache_file.c
@@ -127,7 +127,8 @@ int stream_file_cache_init(stream_t *cache, stream_t *stream,
if (!opts->file || !opts->file[0] || opts->file_max < 1)
return 0;
- FILE *file = fopen(opts->file, "wb+");
+ bool use_anon_file = strcmp(opts->file, "TMP") == 0;
+ FILE *file = use_anon_file ? tmpfile() : fopen(opts->file, "wb+");
if (!file) {
MP_ERR(cache, "can't open cache file '%s'\n", opts->file);
return -1;