-fix FTBFS

This commit is contained in:
Christian Grothoff 2015-03-21 14:04:13 +01:00
parent 7d9a403275
commit 067d489141
2 changed files with 9 additions and 27 deletions

View File

@ -23,7 +23,7 @@
#include <libpq-fe.h> #include <libpq-fe.h>
#include "taler_util.h" #include "taler_util.h"
#include "taler_mintdb_plugin.h" #include "taler_mintdb_plugin.h"
#include "plugin.h"
/** /**
* Mint directory with the keys. * Mint directory with the keys.
@ -35,12 +35,6 @@ static char *mint_base_dir;
*/ */
static struct GNUNET_CONFIGURATION_Handle *cfg; static struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Database connection handle.
*/
static PGconn *db_conn;
/** /**
* The main function of the database initialization tool. * The main function of the database initialization tool.
@ -61,7 +55,6 @@ main (int argc,
&GNUNET_GETOPT_set_filename, &mint_base_dir}, &GNUNET_GETOPT_set_filename, &mint_base_dir},
GNUNET_GETOPT_OPTION_END GNUNET_GETOPT_OPTION_END
}; };
char *db_connection_cfg_str;
if (GNUNET_GETOPT_run ("taler-mint-dbinit", if (GNUNET_GETOPT_run ("taler-mint-dbinit",
options, options,
@ -78,7 +71,6 @@ main (int argc,
"Mint base directory not given.\n"); "Mint base directory not given.\n");
return 1; return 1;
} }
cfg = TALER_config_load (mint_base_dir); cfg = TALER_config_load (mint_base_dir);
if (NULL == cfg) if (NULL == cfg)
{ {
@ -87,32 +79,22 @@ main (int argc,
return 1; return 1;
} }
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg, TALER_MINT_plugin_load (cfg))
"mint",
"db",
&db_connection_cfg_str))
{ {
fprintf (stderr, fprintf (stderr,
"Configuration 'mint.db' not found.\n"); "Failed to initialize database plugin.\n");
return 1; return 1;
} }
db_conn = PQconnectdb (db_connection_cfg_str); if (GNUNET_OK !=
if (CONNECTION_OK != PQstatus (db_conn)) plugin->create_tables (plugin->cls,
{ GNUNET_NO))
fprintf (stderr,
"Database connection failed: %s\n",
PQerrorMessage (db_conn));
free (db_connection_cfg_str);
return 1;
}
free (db_connection_cfg_str);
if (GNUNET_OK != TALER_MINT_DB_create_tables (GNUNET_NO))
{ {
fprintf (stderr, fprintf (stderr,
"Failed to initialize database.\n"); "Failed to initialize database.\n");
TALER_MINT_plugin_unload ();
return 1; return 1;
} }
TALER_MINT_plugin_unload ();
return 0; return 0;
} }

View File

@ -36,6 +36,7 @@
#include "taler-mint-httpd_refresh.h" #include "taler-mint-httpd_refresh.h"
#include "taler-mint-httpd_keystate.h" #include "taler-mint-httpd_keystate.h"
#include "taler_mintdb_plugin.h" #include "taler_mintdb_plugin.h"
#include "plugin.h"
/** /**
@ -229,7 +230,6 @@ mint_serve_process_config (const char *mint_directory)
unsigned long long port; unsigned long long port;
unsigned long long kappa; unsigned long long kappa;
char *master_pub_str; char *master_pub_str;
char *db_cfg;
cfg = TALER_config_load (mint_directory); cfg = TALER_config_load (mint_directory);
if (NULL == cfg) if (NULL == cfg)