From ffd9a8b892b9b99776fa0c7090d3f17796170947 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 16 Feb 2024 18:16:30 +0100 Subject: [PATCH] conf: fix override directory order We need to load and apply the overrides in the order: If absolute config path, use only that. If environment variable, use only that. Else /usr/share/pipewire/*.conf.d/ /etc/pipewire/*.conf.d/ $HOME/.config/pipewire/*.conf.d/ Before this patch we would first apply $HOME and then /etc and /usr, which is not expected. --- src/pipewire/conf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pipewire/conf.c b/src/pipewire/conf.c index ac8c3c4cc..87a2586c6 100644 --- a/src/pipewire/conf.c +++ b/src/pipewire/conf.c @@ -162,6 +162,7 @@ no_config: static int get_config_dir(char *path, size_t size, const char *prefix, const char *name, int *level) { int res; + bool no_config; if (prefix == NULL) { prefix = name; @@ -173,7 +174,8 @@ static int get_config_dir(char *path, size_t size, const char *prefix, const cha return -ENOENT; } - if (pw_check_option("no-config", "true")) + no_config = pw_check_option("no-config", "true"); + if (no_config) goto no_config; if ((res = get_envconf_path(path, size, prefix, name)) != 0) { @@ -183,9 +185,12 @@ static int get_config_dir(char *path, size_t size, const char *prefix, const cha } if (*level == 0) { +no_config: (*level)++; - if ((res = get_homeconf_path(path, size, prefix, name)) != 0) + if ((res = get_confdata_path(path, size, prefix, name)) != 0) return res; + if (no_config) + return 0; } if (*level == 1) { (*level)++; @@ -193,9 +198,8 @@ static int get_config_dir(char *path, size_t size, const char *prefix, const cha return res; } if (*level == 2) { -no_config: (*level)++; - if ((res = get_confdata_path(path, size, prefix, name)) != 0) + if ((res = get_homeconf_path(path, size, prefix, name)) != 0) return res; } return 0;