merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 487d006119847ff0f29e38d3ab894191e22ca18a
parent 9a10cd55a37993d538085a4577042e1ca1866f08
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Fri, 17 Apr 2026 15:41:36 +0200

fix taler-merchant-dbinit

Diffstat:
Msrc/backenddb/meson.build | 4+++-
Msrc/merchant-tools/taler-merchant-dbinit.c | 26+++++++++++---------------
2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/backenddb/meson.build b/src/backenddb/meson.build @@ -1,6 +1,8 @@ # This build file is in the public domain -install_data('merchantdb-postgres.conf', install_dir: pkgcfgdir) +install_data('merchantdb-postgres.conf', + install_dir: pkgcfgdir +) subdir('sql-schema') diff --git a/src/merchant-tools/taler-merchant-dbinit.c b/src/merchant-tools/taler-merchant-dbinit.c @@ -50,27 +50,16 @@ static int gc_db; * @param cls closure * @param args remaining command-line arguments * @param cfgfile name of the configuration file used (for saving, can be NULL!) - * @param config configuration + * @param cfg configuration */ static void run (void *cls, char *const *args, const char *cfgfile, - const struct GNUNET_CONFIGURATION_Handle *config) + const struct GNUNET_CONFIGURATION_Handle *cfg) { struct TALER_MERCHANTDB_PostgresContext *pg; - struct GNUNET_CONFIGURATION_Handle *cfg; - cfg = GNUNET_CONFIGURATION_dup (config); - if (NULL == - (pg = TALER_MERCHANTDB_connect (cfg))) - { - fprintf (stderr, - "Failed to initialize database plugin.\n"); - global_ret = 1; - GNUNET_CONFIGURATION_destroy (cfg); - return; - } if (reset_db) { if (GNUNET_OK != @@ -82,6 +71,14 @@ run (void *cls, } if (gc_db) { + if (NULL == + (pg = TALER_MERCHANTDB_connect (cfg))) + { + fprintf (stderr, + "Failed to initialize database connection.\n"); + global_ret = 1; + return; + } if (GNUNET_OK != TALER_MERCHANTDB_gc (pg)) { @@ -89,6 +86,7 @@ run (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to garbage collect database\n"); } + TALER_MERCHANTDB_disconnect (pg); } else { @@ -100,8 +98,6 @@ run (void *cls, "Failed to initialize tables\n"); } } - TALER_MERCHANTDB_disconnect (pg); - GNUNET_CONFIGURATION_destroy (cfg); }