filter-chain: improve error reporting

Don't overwrite the errno from the plugin loader with 0 so that we can
actually report the right error.
This commit is contained in:
Wim Taymans 2022-02-22 12:42:36 +01:00
parent bc8df52317
commit 580f499939

View file

@ -726,7 +726,6 @@ static struct plugin *plugin_load(struct impl *impl, const char *type, const cha
{ {
struct fc_plugin *pl = NULL; struct fc_plugin *pl = NULL;
struct plugin *hndl; struct plugin *hndl;
int res = 0;
const struct spa_support *support; const struct spa_support *support;
uint32_t n_support; uint32_t n_support;
@ -750,6 +749,11 @@ static struct plugin *plugin_load(struct impl *impl, const char *type, const cha
pl = load_lv2_plugin(support, n_support, path, NULL); pl = load_lv2_plugin(support, n_support, path, NULL);
} }
#endif #endif
else {
pl = NULL;
errno = EINVAL;
}
if (pl == NULL) if (pl == NULL)
goto exit; goto exit;
@ -769,9 +773,7 @@ static struct plugin *plugin_load(struct impl *impl, const char *type, const cha
spa_list_append(&impl->plugin_list, &hndl->link); spa_list_append(&impl->plugin_list, &hndl->link);
return hndl; return hndl;
exit: exit:
errno = -res;
return NULL; return NULL;
} }