summaryrefslogtreecommitdiffstats
path: root/player/configfiles.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-17 02:55:31 +0200
committerwm4 <wm4@nowhere>2014-10-17 02:55:31 +0200
commit01e1d0948d69a1bf6d830de5cae54bd4c1cdab47 (patch)
tree4a8c890aebd8b3e4cf2c4f33e4ca7c38be635da4 /player/configfiles.c
parent41b2927f39f08f54039093746e1d1eded826101e (diff)
downloadmpv-01e1d0948d69a1bf6d830de5cae54bd4c1cdab47.tar.bz2
mpv-01e1d0948d69a1bf6d830de5cae54bd4c1cdab47.tar.xz
options: don't load per-file config files by default
Generally useless feature, and might be slightly dangerous if paths can "escape" from the profile dir. (Normally this shouldn't be possible, though.)
Diffstat (limited to 'player/configfiles.c')
-rw-r--r--player/configfiles.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/player/configfiles.c b/player/configfiles.c
index bbc7ecc12a..75011eb9fa 100644
--- a/player/configfiles.c
+++ b/player/configfiles.c
@@ -111,15 +111,15 @@ static void mp_load_per_file_config(struct MPContext *mpctx)
char cfg[512];
const char *file = mpctx->filename;
- if (snprintf(cfg, sizeof(cfg), "%s.conf", file) >= sizeof(cfg)) {
- MP_VERBOSE(mpctx, "Filename is too long, "
- "can not load file or directory specific config files\n");
- return;
- }
+ if (opts->use_filedir_conf) {
+ if (snprintf(cfg, sizeof(cfg), "%s.conf", file) >= sizeof(cfg)) {
+ MP_VERBOSE(mpctx, "Filename is too long, can not load file or "
+ "directory specific config files\n");
+ return;
+ }
- char *name = mp_basename(cfg);
+ char *name = mp_basename(cfg);
- if (opts->use_filedir_conf) {
bstr dir = mp_dirname(cfg);
char *dircfg = mp_path_join(NULL, dir, bstr0("mpv.conf"));
try_load_config(mpctx, dircfg, FILE_LOCAL_FLAGS);
@@ -127,12 +127,12 @@ static void mp_load_per_file_config(struct MPContext *mpctx)
if (try_load_config(mpctx, cfg, FILE_LOCAL_FLAGS))
return;
- }
- if ((confpath = mp_find_config_file(NULL, mpctx->global, name))) {
- try_load_config(mpctx, confpath, FILE_LOCAL_FLAGS);
+ if ((confpath = mp_find_config_file(NULL, mpctx->global, name))) {
+ try_load_config(mpctx, confpath, FILE_LOCAL_FLAGS);
- talloc_free(confpath);
+ talloc_free(confpath);
+ }
}
}