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>
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;