ucm: fix optional include

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.

Signed-off-by: Huang Yunxuan <hyx0329@outlook.com>
This commit is contained in:
Huang Yunxuan 2026-03-18 22:36:24 +08:00
parent 5414277612
commit 98415d26dd

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;