diff options
author | Dudemanguy <random342@airmail.cc> | 2023-07-05 15:11:40 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-07-06 13:08:23 +0000 |
commit | ee69d99bd409d31ec35ee6f6be53db4ff29a55c9 (patch) | |
tree | 74d33ae41d88d1467b82fed966e803a3300607cd /demux | |
parent | 48e0ee9979c2928edef813e64592217420dbd4a0 (diff) | |
download | mpv-ee69d99bd409d31ec35ee6f6be53db4ff29a55c9.tar.bz2 mpv-ee69d99bd409d31ec35ee6f6be53db4ff29a55c9.tar.xz |
various: correctly ignore cache files with --no-config
--no-config should prevent loading user files of any type: configs,
cache, etc. For cache files, this case wasn't properly handled and it
was assumed they would always get something. vo_gpu's shader cache
actually already handles this, so it was left untouched. In theory,
demuxer cache should never have this issue because saving it to disk is
disabled by default (and likely that will never change), but go ahead
and change it for consistency's sake. Fixes some segfaults with
--no-config and various combinations of settings (particularly
--vo=gpu-next).
Diffstat (limited to 'demux')
-rw-r--r-- | demux/cache.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/demux/cache.c b/demux/cache.c index 08ac193cdf..106f53dbed 100644 --- a/demux/cache.c +++ b/demux/cache.c @@ -105,8 +105,11 @@ struct demux_cache *demux_cache_create(struct mpv_global *global, } else { cache_dir = mp_find_user_file(NULL, global, "cache", ""); } - mp_mkdirp(cache_dir); + if (!cache_dir || !cache_dir[0]) + goto fail; + + mp_mkdirp(cache_dir); cache->filename = mp_path_join(cache, cache_dir, "mpv-cache-XXXXXX.dat"); cache->fd = mp_mkostemps(cache->filename, 4, O_CLOEXEC); if (cache->fd < 0) { |