ucm: fix optional include
Some checks are pending
Build alsa-lib / fedora_latest_build (push) Waiting to run
Build alsa-lib / ubuntu_last_build (push) Waiting to run

The path is not an absolute path and can't be used with `access()`.
Let's call `uc_mgr_config_load_file()` directly and mask acceptable
error numbers.

Closes: https://github.com/alsa-project/alsa-lib/pull/499
Signed-off-by: Huang Yunxuan <hyx0329@outlook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Huang Yunxuan 2026-03-18 22:36:24 +08:00 committed by Jaroslav Kysela
parent d8ca4a7cc4
commit 62c24074ae

View file

@ -90,11 +90,10 @@ static int include_eval_one(snd_use_case_mgr_t *uc_mgr,
err = uc_mgr_get_substituted_value(uc_mgr, &s, file);
if (err < 0)
return err;
if (opt_bool && access(s, R_OK) != 0) {
snd_trace(UCM, "optional file '%s' not found", s);
err = uc_mgr_config_load_file(uc_mgr, s, result);
if (opt_bool && (err == -ENOENT || err == -EACCES)) {
snd_trace(UCM, "optional file '%s' not found or readable", s);
err = 0;
} else {
err = uc_mgr_config_load_file(uc_mgr, s, result);
}
free(s);
return err;