From 5cb7d4c01929a01d1302ec746087b91752566351 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 28 Mar 2024 17:00:18 +0100 Subject: [PATCH] conf: add more error checks Fail when something goes wrong when adding spa-libs instead of silently ignoring it. --- src/pipewire/conf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pipewire/conf.c b/src/pipewire/conf.c index 422153eef..0cc1b95b0 100644 --- a/src/pipewire/conf.c +++ b/src/pipewire/conf.c @@ -551,6 +551,7 @@ static int parse_spa_libs(void *user_data, const char *location, struct pw_context *context = d->context; struct spa_json it[2]; char key[512], value[512]; + int res; spa_json_init(&it[0], str, len); if (spa_json_enter_object(&it[0], &it[1]) < 0) { @@ -560,7 +561,11 @@ static int parse_spa_libs(void *user_data, const char *location, while (spa_json_get_string(&it[1], key, sizeof(key)) > 0) { if (spa_json_get_string(&it[1], value, sizeof(value)) > 0) { - pw_context_add_spa_lib(context, key, value); + if ((res = pw_context_add_spa_lib(context, key, value)) < 0) { + pw_log_error("error adding spa-libs for '%s' in '%.*s': %s", + key, (int)len, str, spa_strerror(res)); + return res; + } d->count++; } else { pw_log_warn("config file error: missing spa-libs library name for '%s'", key);