From: George Joseph Date: Tue, 11 Feb 2025 18:35:14 +0000 (-0700) Subject: res_config_pgsql: Fix regression that removed dbname config. X-Git-Tag: 21.8.0-rc1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c2bf8b5358f130abc5c2254d5182abce5b490fd;p=thirdparty%2Fasterisk.git res_config_pgsql: Fix regression that removed dbname config. A recent commit accidentally removed the code that sets dbname. This commit adds it back in. Resolves: #1119 (cherry picked from commit 89764215049dc2f8e883b43e70043573fcbe6ed2) --- diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index cb57ee9f40..1a2fc224b8 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -1495,6 +1495,14 @@ static int parse_config(int is_reload) ast_copy_string(dbhost, s, sizeof(dbhost)); } + if (!(s = ast_variable_retrieve(config, "general", "dbname"))) { + ast_log(LOG_WARNING, + "PostgreSQL RealTime: No database name found, using 'asterisk' as default.\n"); + strcpy(dbname, "asterisk"); + } else { + ast_copy_string(dbname, s, sizeof(dbname)); + } + /* Check new 'port' option first, then fall back to legacy 'dbport' */ s = ast_variable_retrieve(config, "general", "port"); if (!s) {