summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-29 23:56:46 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-29 23:56:46 +0200
commit0ef7c0a0b716785e7d1b0233e622d2e7267a0280 (patch)
treeff4b46d1182acd71fa5c6e29b9aaa786dbcf2b22
parent1b419adab48fc0fd915835e0d57c5923e515280c (diff)
downloadexchange-0ef7c0a0b716785e7d1b0233e622d2e7267a0280.tar.gz
exchange-0ef7c0a0b716785e7d1b0233e622d2e7267a0280.tar.bz2
exchange-0ef7c0a0b716785e7d1b0233e622d2e7267a0280.zip
fix #6960
-rw-r--r--src/auditor/Makefile.am10
-rw-r--r--src/auditor/taler-auditor-dbinit.c10
-rw-r--r--src/auditor/taler-auditor-exchange.c22
-rw-r--r--src/auditor/taler-auditor-httpd.c14
-rw-r--r--src/auditor/taler-auditor-sync.c20
-rw-r--r--src/exchange-tools/taler-auditor-offline.c66
-rw-r--r--src/exchange-tools/taler-exchange-dbinit.c11
-rw-r--r--src/exchange-tools/taler-exchange-offline.c132
-rw-r--r--src/exchange/taler-exchange-aggregator.c42
-rw-r--r--src/exchange/taler-exchange-closer.c39
-rw-r--r--src/exchange/taler-exchange-httpd.c18
-rw-r--r--src/exchange/taler-exchange-transfer.c44
-rw-r--r--src/exchange/taler-exchange-wirewatch.c28
-rw-r--r--src/include/platform.h27
-rw-r--r--src/json/Makefile.am4
-rw-r--r--src/mhd/Makefile.am2
-rw-r--r--src/pq/Makefile.am2
-rw-r--r--src/sq/Makefile.am2
-rw-r--r--src/util/Makefile.am2
19 files changed, 236 insertions, 259 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
index b040126c..09a0deec 100644
--- a/src/auditor/Makefile.am
+++ b/src/auditor/Makefile.am
@@ -130,8 +130,8 @@ taler_helper_auditor_wire_SOURCES = \
taler-helper-auditor-wire.c
taler_helper_auditor_wire_LDADD = \
$(LIBGCRYPT_LIBS) \
- $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/json/libtalerjson.la \
+ $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/bank-lib/libtalerbank.la \
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
$(top_builddir)/src/auditordb/libtalerauditordb.la \
@@ -174,11 +174,13 @@ taler_auditor_exchange_LDADD = \
taler_auditor_sync_SOURCES = \
taler-auditor-sync.c
taler_auditor_sync_LDADD = \
- $(LIBGCRYPT_LIBS) \
- $(top_builddir)/src/util/libtalerutil.la \
- $(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
+ $(top_builddir)/src/pq/libtalerpq.la \
+ $(top_builddir)/src/json/libtalerjson.la \
+ $(top_builddir)/src/util/libtalerutil.la \
+ -lgnunetjson \
-lgnunetutil \
+ $(LIBGCRYPT_LIBS) \
$(XLIB)
taler_auditor_sync_LDFLAGS = \
$(POSTGRESQL_LDFLAGS)
diff --git a/src/auditor/taler-auditor-dbinit.c b/src/auditor/taler-auditor-dbinit.c
index d0509fc0..fe5e5310 100644
--- a/src/auditor/taler-auditor-dbinit.c
+++ b/src/auditor/taler-auditor-dbinit.c
@@ -69,7 +69,7 @@ run (void *cls,
{
fprintf (stderr,
"Failed to initialize database plugin.\n");
- global_ret = 1;
+ global_ret = EXIT_NOTINSTALLED;
return;
}
if (reset_db)
@@ -94,7 +94,7 @@ run (void *cls,
fprintf (stderr,
"Failed to initialize database.\n");
TALER_AUDITORDB_plugin_unload (plugin);
- global_ret = 1;
+ global_ret = EXIT_NOPERMISSION;
return;
}
if (gc_db)
@@ -143,7 +143,7 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
- return 4;
+ return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run (
argc, argv,
"taler-auditor-dbinit",
@@ -152,9 +152,9 @@ main (int argc,
&run, NULL);
GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
- return 3;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
return global_ret;
}
diff --git a/src/auditor/taler-auditor-exchange.c b/src/auditor/taler-auditor-exchange.c
index e8e40ba5..b8b8428e 100644
--- a/src/auditor/taler-auditor-exchange.c
+++ b/src/auditor/taler-auditor-exchange.c
@@ -99,9 +99,9 @@ main (int argc,
options,
argc, argv);
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
if (NULL == cfgfile)
cfgfile = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file);
@@ -119,7 +119,7 @@ main (int argc,
"Malformed configuration file `%s', exit ...\n",
cfgfile);
GNUNET_free (cfgfile);
- return 1;
+ return EXIT_NOTCONFIGURED;
}
GNUNET_free (cfgfile);
@@ -131,7 +131,7 @@ main (int argc,
_ ("Missing either `%s' or `%s'.\n"),
"-u URL",
"--remove");
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
if ( (0 == strlen (exchange_url)) ||
( (0 != strncasecmp ("http://",
@@ -144,7 +144,7 @@ main (int argc,
{
fprintf (stderr,
"Exchange URL must begin with `http://` or `https://` and end with `/'\n");
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
}
@@ -154,7 +154,7 @@ main (int argc,
{
fprintf (stderr,
"Failed to initialize auditor database plugin.\n");
- return 3;
+ return EXIT_NOTINSTALLED;
}
/* Create required tables */
@@ -164,7 +164,7 @@ main (int argc,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to create tables in auditor's database\n");
TALER_AUDITORDB_plugin_unload (adb);
- return 3;
+ return EXIT_NOPERMISSION;
}
/* Update DB */
@@ -178,7 +178,7 @@ main (int argc,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to initialize database session\n");
TALER_AUDITORDB_plugin_unload (adb);
- return 3;
+ return EXIT_FAILURE;
}
if (remove_flag)
@@ -200,7 +200,7 @@ main (int argc,
"Failed to update auditor database (status code: %d)\n",
qs);
TALER_AUDITORDB_plugin_unload (adb);
- return 3;
+ return EXIT_FAILURE;
}
if (0 == qs)
{
@@ -210,11 +210,11 @@ main (int argc,
? "Could not remove exchange from database: entry already absent\n"
: "Could not add exchange to database: entry already exists\n");
TALER_AUDITORDB_plugin_unload (adb);
- return 4;
+ return EXIT_FAILURE;
}
}
TALER_AUDITORDB_plugin_unload (adb);
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c
index 36d0547f..d68ec759 100644
--- a/src/auditor/taler-auditor-httpd.c
+++ b/src/auditor/taler-auditor-httpd.c
@@ -576,9 +576,9 @@ main (int argc,
options,
argc, argv);
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return 3;
+ return EXIT_FAILURE;
}
go = TALER_MHD_GO_NONE;
if (auditor_connection_close)
@@ -599,13 +599,13 @@ main (int argc,
"Malformed configuration file `%s', exiting ...\n",
cfgfile);
GNUNET_free (cfgfile);
- return 1;
+ return EXIT_NOTCONFIGURED;
}
GNUNET_free (cfgfile);
if (GNUNET_OK !=
auditor_serve_process_config ())
- return 1;
+ return EXIT_NOTCONFIGURED;
TEAH_DEPOSIT_CONFIRMATION_init ();
/* check for systemd-style FD passing */
listen_pid = getenv ("LISTEN_PID");
@@ -649,7 +649,7 @@ main (int argc,
if (-1 == fh)
{
TEAH_DEPOSIT_CONFIRMATION_done ();
- return 1;
+ return EXIT_NOPERMISSION; /* most likely at least */
}
}
@@ -674,7 +674,7 @@ main (int argc,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start HTTP server.\n");
TEAH_DEPOSIT_CONFIRMATION_done ();
- return 1;
+ return EXIT_FAILURE;
}
/* normal behavior */
@@ -751,7 +751,7 @@ main (int argc,
TALER_EXCHANGEDB_plugin_unload (TAH_eplugin);
TAH_eplugin = NULL;
TEAH_DEPOSIT_CONFIRMATION_done ();
- return (GNUNET_SYSERR == ret) ? 1 : 0;
+ return (GNUNET_SYSERR == ret) ? EXIT_FAILURE : EXIT_SUCCESS;
}
diff --git a/src/auditor/taler-auditor-sync.c b/src/auditor/taler-auditor-sync.c
index 84562c5b..5f9111ce 100644
--- a/src/auditor/taler-auditor-sync.c
+++ b/src/auditor/taler-auditor-sync.c
@@ -269,7 +269,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to lookup records from table %d: hard error\n",
i);
- global_ret = 3;
+ global_ret = EXIT_FAILURE;
return GNUNET_SYSERR;
}
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
@@ -285,7 +285,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
"Failed to lookup records from table %d: no results\n",
i);
GNUNET_break (0); /* should be impossible */
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return GNUNET_SYSERR;
}
if (0 == ctx.qs)
@@ -306,7 +306,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Hard error committing transaction on table %d\n",
i);
- global_ret = 5;
+ global_ret = EXIT_FAILURE;
return GNUNET_SYSERR;
}
}
@@ -530,13 +530,13 @@ setup (struct GNUNET_CONFIGURATION_Handle *src_cfg,
src = TALER_EXCHANGEDB_plugin_load (src_cfg);
if (NULL == src)
{
- global_ret = 3;
+ global_ret = EXIT_NOTINSTALLED;
return;
}
dst = TALER_EXCHANGEDB_plugin_load (dst_cfg);
if (NULL == dst)
{
- global_ret = 3;
+ global_ret = EXIT_NOTINSTALLED;
TALER_EXCHANGEDB_plugin_unload (src);
src = NULL;
return;
@@ -601,9 +601,9 @@ main (int argc,
options,
argc, argv);
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
GNUNET_assert (GNUNET_OK ==
GNUNET_log_setup ("taler-auditor-sync",
@@ -615,14 +615,14 @@ main (int argc,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Source and destination configuration files must differ!\n");
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
src_cfg = load_config (src_cfgfile);
if (NULL == src_cfg)
{
GNUNET_free (src_cfgfile);
GNUNET_free (dst_cfgfile);
- return 1;
+ return EXIT_NOTCONFIGURED;
}
dst_cfg = load_config (dst_cfgfile);
if (NULL == dst_cfg)
@@ -630,7 +630,7 @@ main (int argc,
GNUNET_CONFIGURATION_destroy (src_cfg);
GNUNET_free (src_cfgfile);
GNUNET_free (dst_cfgfile);
- return 1;
+ return EXIT_NOTCONFIGURED;
}
setup (src_cfg,
dst_cfg);
diff --git a/src/exchange-tools/taler-auditor-offline.c b/src/exchange-tools/taler-auditor-offline.c
index 33743bb3..cc7278e5 100644
--- a/src/exchange-tools/taler-auditor-offline.c
+++ b/src/exchange-tools/taler-auditor-offline.c
@@ -407,7 +407,7 @@ denomination_add_cb (
NULL != hr->hint
? hr->hint
: "no hint provided");
- global_ret = 42;
+ global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (dar_head,
dar_tail,
@@ -453,7 +453,7 @@ upload_denomination_add (const char *exchange_url,
err_name,
err_line,
(unsigned int) idx);
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -505,7 +505,7 @@ trigger_upload (const char *exchange_url)
{
fprintf (stderr,
"Malformed JSON input\n");
- global_ret = 3;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -527,7 +527,7 @@ trigger_upload (const char *exchange_url)
fprintf (stderr,
"Upload does not know how to handle `%s'\n",
key);
- global_ret = 3;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -561,7 +561,7 @@ do_upload (char *const *args)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"auditor",
"PUBLIC_KEY");
- global_ret = 4;
+ global_ret = EXIT_NOTCONFIGURED;
test_shutdown ();
return;
}
@@ -576,7 +576,7 @@ do_upload (char *const *args)
"PUBLIC_KEY",
"invalid key");
GNUNET_free (auditor_public_key_str);
- global_ret = 4;
+ global_ret = EXIT_NOTCONFIGURED;
test_shutdown ();
return;
}
@@ -587,7 +587,7 @@ do_upload (char *const *args)
fprintf (stderr,
"Downloaded data was not consumed, refusing upload\n");
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
if (NULL == out)
@@ -606,7 +606,7 @@ do_upload (char *const *args)
err.source,
err.position);
test_shutdown ();
- global_ret = 2;
+ global_ret = EXIT_FAILURE;
return;
}
}
@@ -615,7 +615,7 @@ do_upload (char *const *args)
fprintf (stderr,
"Error: expected JSON array for `upload` command\n");
test_shutdown ();
- global_ret = 2;
+ global_ret = EXIT_FAILURE;
return;
}
if (GNUNET_OK !=
@@ -627,7 +627,7 @@ do_upload (char *const *args)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange",
"BASE_URL");
- global_ret = 1;
+ global_ret = EXIT_NOTCONFIGURED;
test_shutdown ();
return;
}
@@ -670,7 +670,7 @@ keys_cb (
TALER_EXCHANGE_disconnect (exchange);
exchange = NULL;
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
in = json_pack ("{s:s,s:O}",
@@ -712,7 +712,7 @@ do_download (char *const *args)
"exchange",
"BASE_URL");
test_shutdown ();
- global_ret = 1;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
exchange = TALER_EXCHANGE_connect (ctx,
@@ -795,7 +795,7 @@ show_denomkeys (const json_t *denomkeys)
err_line,
(unsigned int) index);
GNUNET_JSON_parse_free (spec);
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -821,7 +821,7 @@ show_denomkeys (const json_t *denomkeys)
fprintf (stderr,
"Invalid master signature for key %s (aborting)\n",
TALER_B2S (&h_denom_pub));
- global_ret = 9;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -907,7 +907,7 @@ parse_keys (const char *command_name)
err.line,
err.source,
err.position);
- global_ret = 2;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return NULL;
}
@@ -926,7 +926,7 @@ parse_keys (const char *command_name)
json_dumpf (in,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return NULL;
}
@@ -985,7 +985,7 @@ do_show (char *const *args)
"Invalid input to 'show': %s#%u (skipping)\n",
err_name,
err_line);
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
json_decref (keys);
return;
@@ -996,7 +996,7 @@ do_show (char *const *args)
{
fprintf (stderr,
"Exchange master public key does not match key we have configured (aborting)\n");
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
json_decref (keys);
return;
@@ -1004,7 +1004,7 @@ do_show (char *const *args)
if (GNUNET_OK !=
show_denomkeys (denomkeys))
{
- global_ret = 8;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
json_decref (keys);
@@ -1094,7 +1094,7 @@ sign_denomkeys (const json_t *denomkeys)
err_line,
(unsigned int) index);
GNUNET_JSON_parse_free (spec);
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -1118,7 +1118,7 @@ sign_denomkeys (const json_t *denomkeys)
fprintf (stderr,
"Invalid master signature for key %s (aborting)\n",
TALER_B2S (&h_denom_pub));
- global_ret = 9;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -1197,7 +1197,7 @@ do_sign (char *const *args)
"Invalid input to 'sign': %s#%u (skipping)\n",
err_name,
err_line);
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
json_decref (keys);
return;
@@ -1208,7 +1208,7 @@ do_sign (char *const *args)
{
fprintf (stderr,
"Exchange master public key does not match key we have configured (aborting)\n");
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
json_decref (keys);
return;
@@ -1218,7 +1218,7 @@ do_sign (char *const *args)
if (GNUNET_OK !=
sign_denomkeys (denomkeys))
{
- global_ret = 8;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
json_decref (keys);
@@ -1241,7 +1241,7 @@ do_setup (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_YES))
{
- global_ret = 1;
+ global_ret = EXIT_FAILURE;
return;
}
if (NULL != *args)
@@ -1332,7 +1332,7 @@ work (void *cls)
fprintf (stderr,
"Unexpected command `%s'\n",
args[0]);
- global_ret = 3;
+ global_ret = EXIT_INVALIDARGUMENT;
}
fprintf (stderr,
"Supported subcommands:\n");
@@ -1365,7 +1365,7 @@ run (void *cls,
TALER_config_get_currency (kcfg,
&currency))
{
- global_ret = 1;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
if (GNUNET_OK !=
@@ -1377,7 +1377,7 @@ run (void *cls,
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"auditor",
"BASE_URL");
- global_ret = 1;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
{
@@ -1392,7 +1392,7 @@ run (void *cls,
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange",
"MASTER_PUBLIC_KEY");
- global_ret = 1;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
if (GNUNET_OK !=
@@ -1404,7 +1404,7 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid master public key given in exchange configuration.");
GNUNET_free (master_public_key_str);
- global_ret = 1;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
GNUNET_free (master_public_key_str);
@@ -1446,7 +1446,7 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
- return 4;
+ return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run (
argc, argv,
"taler-auditor-offline",
@@ -1455,9 +1455,9 @@ main (int argc,
&run, NULL);
GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
- return 3;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
return global_ret;
}
diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c
index b1d2100d..3f5542b2 100644
--- a/src/exchange-tools/taler-exchange-dbinit.c
+++ b/src/exchange-tools/taler-exchange-dbinit.c
@@ -38,6 +38,7 @@ static int reset_db;
*/
static int gc_db;
+
/**
* Main function that will be run.
*
@@ -62,7 +63,7 @@ run (void *cls,
{
fprintf (stderr,
"Failed to initialize database plugin.\n");
- global_ret = 1;
+ global_ret = EXIT_NOTINSTALLED;
return;
}
if (reset_db)
@@ -79,7 +80,7 @@ run (void *cls,
fprintf (stderr,
"Failed to initialize database.\n");
TALER_EXCHANGEDB_plugin_unload (plugin);
- global_ret = 1;
+ global_ret = EXIT_NOPERMISSION;
return;
}
if (gc_db)
@@ -126,7 +127,7 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
- return 4;
+ return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run (
argc, argv,
"taler-exchange-dbinit",
@@ -135,9 +136,9 @@ main (int argc,
&run, NULL);
GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
- return 3;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
return global_ret;
}
diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c
index 79b8dd47..3bf8f981 100644
--- a/src/exchange-tools/taler-exchange-offline.c
+++ b/src/exchange-tools/taler-exchange-offline.c
@@ -821,7 +821,7 @@ denom_revocation_cb (
hr->http_status,
hr->hint,
TALER_JSON_get_error_hint (hr->reply));
- global_ret = 10;
+ global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (drr_head,
drr_tail,
@@ -870,7 +870,7 @@ upload_denom_revocation (const char *exchange_url,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -910,7 +910,7 @@ signkey_revocation_cb (
hr->http_status,
hr->hint,
TALER_JSON_get_error_hint (hr->reply));
- global_ret = 10;
+ global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (srr_head,
srr_tail,
@@ -959,7 +959,7 @@ upload_signkey_revocation (const char *exchange_url,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -998,7 +998,7 @@ auditor_add_cb (void *cls,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
- global_ret = 10;
+ global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (aar_head,
aar_tail,
@@ -1056,7 +1056,7 @@ upload_auditor_add (const char *exchange_url,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -1098,7 +1098,7 @@ auditor_del_cb (void *cls,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
- global_ret = 10;
+ global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (adr_head,
adr_tail,
@@ -1150,7 +1150,7 @@ upload_auditor_del (const char *exchange_url,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -1190,7 +1190,7 @@ wire_add_cb (void *cls,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
- global_ret = 10;
+ global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (war_head,
war_tail,
@@ -1245,7 +1245,7 @@ upload_wire_add (const char *exchange_url,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -1258,7 +1258,7 @@ upload_wire_add (const char *exchange_url,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"payto:// URI `%s' is malformed\n",
payto_uri);
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -1301,7 +1301,7 @@ wire_del_cb (void *cls,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
- global_ret = 10;
+ global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (wdr_head,
wdr_tail,
@@ -1353,7 +1353,7 @@ upload_wire_del (const char *exchange_url,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -1394,7 +1394,7 @@ wire_fee_cb (
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
- global_ret = 10;
+ global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (wfr_head,
wfr_tail,
@@ -1457,7 +1457,7 @@ upload_wire_fee (const char *exchange_url,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -1501,7 +1501,7 @@ keys_cb (
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
- global_ret = 10;
+ global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (ukr_head,
ukr_tail,
@@ -1551,7 +1551,7 @@ upload_keys (const char *exchange_url,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -1644,7 +1644,7 @@ upload_keys (const char *exchange_url,
}
else
{
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
}
GNUNET_free (pkd.sign_sigs);
@@ -1713,7 +1713,7 @@ trigger_upload (const char *exchange_url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed JSON input\n");
- global_ret = 3;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -1735,7 +1735,7 @@ trigger_upload (const char *exchange_url)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload does not know how to handle `%s'\n",
key);
- global_ret = 3;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
@@ -1758,7 +1758,7 @@ do_upload (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, refusing upload\n");
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
if (NULL == out)
@@ -1777,7 +1777,7 @@ do_upload (char *const *args)
err.source,
err.position);
test_shutdown ();
- global_ret = 2;
+ global_ret = EXIT_FAILURE;
return;
}
}
@@ -1786,7 +1786,7 @@ do_upload (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error: expected JSON array for `upload` command\n");
test_shutdown ();
- global_ret = 2;
+ global_ret = EXIT_FAILURE;
return;
}
if (GNUNET_OK !=
@@ -1798,7 +1798,7 @@ do_upload (char *const *args)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange",
"BASE_URL");
- global_ret = 1;
+ global_ret = EXIT_NOTCONFIGURED;
test_shutdown ();
return;
}
@@ -1826,7 +1826,7 @@ do_revoke_denomination_key (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, refusing revocation\n");
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
if ( (NULL == args[0]) ||
@@ -1839,7 +1839,7 @@ do_revoke_denomination_key (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify a denomination key with this subcommand\n");
test_shutdown ();
- global_ret = 5;
+ global_ret = EXIT_INVALIDARGUMENT;
return;
}
if (GNUNET_OK !=
@@ -1875,7 +1875,7 @@ do_revoke_signkey (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, refusing revocation\n");
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
if ( (NULL == args[0]) ||
@@ -1888,7 +1888,7 @@ do_revoke_signkey (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify an exchange signing key with this subcommand\n");
test_shutdown ();
- global_ret = 5;
+ global_ret = EXIT_INVALIDARGUMENT;
return;
}
if (GNUNET_OK !=
@@ -1926,7 +1926,7 @@ do_add_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not adding auditor\n");
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
if ( (NULL == args[0]) ||
@@ -1939,7 +1939,7 @@ do_add_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify an auditor public key as first argument for this subcommand\n");
test_shutdown ();
- global_ret = 5;
+ global_ret = EXIT_INVALIDARGUMENT;
return;
}
@@ -1952,7 +1952,7 @@ do_add_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify an auditor URI and auditor name as 2nd and 3rd arguments to this subcommand\n");
test_shutdown ();
- global_ret = 5;
+ global_ret = EXIT_INVALIDARGUMENT;
return;
}
if (GNUNET_OK !=
@@ -1999,7 +1999,7 @@ do_del_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not deleting auditor account\n");
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
if ( (NULL == args[0]) ||
@@ -2012,7 +2012,7 @@ do_del_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify an auditor public key as first argument for this subcommand\n");
test_shutdown ();
- global_ret = 5;
+ global_ret = EXIT_INVALIDARGUMENT;
return;
}
if (GNUNET_OK !=
@@ -2055,7 +2055,7 @@ do_add_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not adding wire account\n");
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
if (NULL == args[0])
@@ -2063,7 +2063,7 @@ do_add_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify a payto://-URI with this subcommand\n");
test_shutdown ();
- global_ret = 5;
+ global_ret = EXIT_INVALIDARGUMENT;
return;
}
if (GNUNET_OK !=
@@ -2081,7 +2081,7 @@ do_add_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"payto:// URI `%s' is malformed\n",
args[0]);
- global_ret = 7;
+ global_ret = EXIT_INVALIDARGUMENT;
test_shutdown ();
return;
}
@@ -2125,7 +2125,7 @@ do_del_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not deleting wire account\n");
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
if (NULL == args[0])
@@ -2133,7 +2133,7 @@ do_del_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify a payto://-URI with this subcommand\n");
test_shutdown ();
- global_ret = 5;
+ global_ret = EXIT_INVALIDARGUMENT;
return;
}
if (GNUNET_OK !=
@@ -2181,7 +2181,7 @@ do_set_wire_fee (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not setting wire fee\n");
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
if ( (NULL == args[0]) ||
@@ -2204,7 +2204,7 @@ do_set_wire_fee (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must use YEAR, METHOD, WIRE-FEE and CLOSING-FEE as arguments for this subcommand\n");
test_shutdown ();
- global_ret = 5;
+ global_ret = EXIT_INVALIDARGUMENT;
return;
}
if (0 == strcasecmp ("now",
@@ -2270,7 +2270,7 @@ download_cb (void *cls,
hr->http_status,
(unsigned int) hr->ec);
test_shutdown ();
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return;
}
in = json_pack ("{s:s,s:O}",
@@ -2310,7 +2310,7 @@ do_download (char *const *args)
"exchange",
"BASE_URL");
test_shutdown ();
- global_ret = 1;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
mgkh = TALER_EXCHANGE_get_management_keys (ctx,
@@ -2524,7 +2524,7 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -2540,7 +2540,7 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for signing key %s (aborting)\n",
TALER_B2S (&exchange_pub));
- global_ret = 9;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -2641,7 +2641,7 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
stderr,
JSON_INDENT (2));
GNUNET_JSON_parse_free (spec);
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -2660,7 +2660,7 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for denomination key %s (aborting)\n",
GNUNET_h2s (&h_denom_pub));
- global_ret = 9;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -2747,7 +2747,7 @@ parse_keys_input (const char *command_name)
err.line,
err.source,
err.position);
- global_ret = 2;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return NULL;
}
@@ -2766,7 +2766,7 @@ parse_keys_input (const char *command_name)
json_dumpf (in,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return NULL;
}
@@ -2835,7 +2835,7 @@ do_show (char *const *args)
json_dumpf (in,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
json_decref (keys);
return;
@@ -2846,7 +2846,7 @@ do_show (char *const *args)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: exchange uses different master key!\n");
- global_ret = 6;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
json_decref (keys);
@@ -2855,7 +2855,7 @@ do_show (char *const *args)
if (GNUNET_SYSERR ==
tofu_check (secm))
{
- global_ret = 8;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
json_decref (keys);
@@ -2868,7 +2868,7 @@ do_show (char *const *args)
show_denomkeys (&secm[0],
denomkeys)) )
{
- global_ret = 8;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
json_decref (keys);
@@ -2933,7 +2933,7 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
json_dumpf (value,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -2950,7 +2950,7 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for signing key %s (aborting)\n",
TALER_B2S (&exchange_pub));
- global_ret = 9;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
@@ -3060,7 +3060,7 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
stderr,
JSON_INDENT (2));
GNUNET_JSON_parse_free (spec);
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
return GNUNET_SYSERR;
}
@@ -3079,7 +3079,7 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for denomination key %s (aborting)\n",
GNUNET_h2s (&h_denom_pub));
- global_ret = 9;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
@@ -3167,7 +3167,7 @@ do_sign (char *const *args)
json_dumpf (in,
stderr,
JSON_INDENT (2));
- global_ret = 7;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
json_decref (keys);
return;
@@ -3178,7 +3178,7 @@ do_sign (char *const *args)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: exchange uses different master key!\n");
- global_ret = 6;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
json_decref (keys);
@@ -3189,7 +3189,7 @@ do_sign (char *const *args)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: security module keys changed!\n");
- global_ret = 8;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
json_decref (keys);
@@ -3210,7 +3210,7 @@ do_sign (char *const *args)
denomkeys,
denomkey_sig_array)) )
{
- global_ret = 8;
+ global_ret = EXIT_FAILURE;
test_shutdown ();
json_decref (signkey_sig_array);
json_decref (denomkey_sig_array);
@@ -3243,7 +3243,7 @@ do_setup (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_YES))
{
- global_ret = 1;
+ global_ret = EXIT_NOPERMISSION;
return;
}
if (NULL != *args)
@@ -3373,7 +3373,7 @@ work (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"Unexpected command `%s'\n",
args[0]);
- global_ret = 3;
+ global_ret = EXIT_INVALIDARGUMENT;
}
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"Supported subcommands:\n");
@@ -3406,7 +3406,7 @@ run (void *cls,
TALER_config_get_currency (kcfg,
&currency))
{
- global_ret = 1;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
@@ -3446,7 +3446,7 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
- return 4;
+ return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run (
argc, argv,
"taler-exchange-offline",
@@ -3455,9 +3455,9 @@ main (int argc,
&run, NULL);
GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
- return 3;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
return global_ret;
}
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index 786183ad..75de467d 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -153,21 +153,7 @@ static struct GNUNET_TIME_Relative aggregator_idle_sleep_interval;
/**
* Value to return from main(). 0 on success, non-zero on errors.
*/
-static enum
-{
- GR_SUCCESS = 0,
- GR_DATABASE_SESSION_FAIL = 1,
- GR_DATABASE_TRANSACTION_BEGIN_FAIL = 2,
- GR_DATABASE_READY_DEPOSIT_HARD_FAIL = 3,
- GR_DATABASE_ITERATE_DEPOSIT_HARD_FAIL = 4,
- GR_DATABASE_TINY_MARK_HARD_FAIL = 5,
- GR_DATABASE_PREPARE_HARD_FAIL = 6,
- GR_DATABASE_PREPARE_COMMIT_HARD_FAIL = 7,
- GR_INVARIANT_FAILURE = 8,
- GR_CONFIGURATION_INVALID = 9,
- GR_CMD_LINE_UTF8_ERROR = 9,
- GR_CMD_LINE_OPTIONS_WRONG = 10,
-} global_ret;
+static int global_ret;
/**
* #GNUNET_YES if we are in test mode and should exit when idle.
@@ -676,7 +662,7 @@ run_aggregation (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n");
- global_ret = GR_DATABASE_SESSION_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -686,7 +672,7 @@ run_aggregation (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n");
- global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -707,7 +693,7 @@ run_aggregation (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to execute deposit iteration!\n");
- global_ret = GR_DATABASE_READY_DEPOSIT_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -756,7 +742,7 @@ run_aggregation (void *cls)
cleanup_au (&au_active);
db_plugin->rollback (db_plugin->cls,
session);
- global_ret = GR_DATABASE_ITERATE_DEPOSIT_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -805,7 +791,7 @@ run_aggregation (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n");
- global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL;
+ global_ret = EXIT_FAILURE;
cleanup_au (&au_active);
GNUNET_SCHEDULER_shutdown ();
return;
@@ -843,7 +829,7 @@ run_aggregation (void *cls)
db_plugin->rollback (db_plugin->cls,
session);
cleanup_au (&au_active);
- global_ret = GR_DATABASE_TINY_MARK_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -926,7 +912,7 @@ run_aggregation (void *cls)
db_plugin->rollback (db_plugin->cls,
session);
/* die hard */
- global_ret = GR_DATABASE_PREPARE_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -948,7 +934,7 @@ run_aggregation (void *cls)
return;
case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0);
- global_ret = GR_DATABASE_PREPARE_COMMIT_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
@@ -960,7 +946,7 @@ run_aggregation (void *cls)
return;
default:
GNUNET_break (0);
- global_ret = GR_INVARIANT_FAILURE;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -989,7 +975,7 @@ run (void *cls,
if (GNUNET_OK != parse_wirewatch_config ())
{
cfg = NULL;
- global_ret = GR_CONFIGURATION_INVALID;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
GNUNET_assert (NULL == task);
@@ -1025,7 +1011,7 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
- return GR_CMD_LINE_UTF8_ERROR;
+ return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run (
argc, argv,
"taler-exchange-aggregator",
@@ -1035,9 +1021,9 @@ main (int argc,
&run, NULL);
GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
- return GR_CMD_LINE_OPTIONS_WRONG;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
return global_ret;
}
diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c
index 0fd5e1d5..0cd288b4 100644
--- a/src/exchange/taler-exchange-closer.c
+++ b/src/exchange/taler-exchange-closer.c
@@ -66,22 +66,7 @@ static struct GNUNET_TIME_Relative aggregator_idle_sleep_interval;
* Value to return from main(). 0 on success, non-zero
* on serious errors.
*/
-static enum
-{
- GR_SUCCESS = 0,
- GR_WIRE_ACCOUNT_NOT_CONFIGURED = 1,
- GR_WIRE_TRANSFER_FEES_NOT_CONFIGURED = 2,
- GR_FAILURE_TO_ROUND_AMOUNT = 3,
- GR_DATABASE_INSERT_HARD_FAIL = 4,
- GR_DATABASE_SELECT_HARD_FAIL = 5,
- GR_DATABASE_COMMIT_HARD_FAIL = 6,
- GR_DATABASE_SESSION_START_FAIL = 7,
- GR_DATABASE_TRANSACTION_BEGIN_FAIL = 8,
- GR_CONFIGURATION_INVALID = 9,
- GR_CMD_LINE_UTF8_ERROR = 10,
- GR_CMD_LINE_OPTIONS_WRONG = 11,
- GR_INVALID_PAYTO_ENCOUNTERED = 12,
-} global_ret;
+static int global_ret;
/**
* #GNUNET_YES if we are in test mode and should exit when idle.
@@ -268,7 +253,7 @@ expired_reserve_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No wire account configured to deal with target URI `%s'\n",
account_payto_uri);
- global_ret = GR_WIRE_ACCOUNT_NOT_CONFIGURED;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -321,7 +306,7 @@ expired_reserve_cb (void *cls,
&currency_round_unit))
{
GNUNET_break (0);
- global_ret = GR_FAILURE_TO_ROUND_AMOUNT;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -360,7 +345,7 @@ expired_reserve_cb (void *cls,
(GNUNET_DB_STATUS_HARD_ERROR == qs) )
{
GNUNET_break (0);
- global_ret = GR_DATABASE_INSERT_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -396,7 +381,7 @@ expired_reserve_cb (void *cls,
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
GNUNET_break (0);
- global_ret = GR_DATABASE_INSERT_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -429,7 +414,7 @@ run_reserve_closures (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n");
- global_ret = GR_DATABASE_SESSION_START_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -441,7 +426,7 @@ run_reserve_closures (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n");
- global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -463,7 +448,7 @@ run_reserve_closures (void *cls)
GNUNET_break (0);
db_plugin->rollback (db_plugin->cls,
session);
- global_ret = GR_DATABASE_SELECT_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
case GNUNET_DB_STATUS_SOFT_ERROR:
@@ -524,7 +509,7 @@ run (void *cls,
if (GNUNET_OK != parse_wirewatch_config ())
{
cfg = NULL;
- global_ret = GR_CONFIGURATION_INVALID;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
GNUNET_assert (NULL == task);
@@ -560,7 +545,7 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
- return GR_CMD_LINE_UTF8_ERROR;
+ return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run (
argc, argv,
"taler-exchange-closer",
@@ -569,9 +554,9 @@ main (int argc,
&run, NULL);
GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
- return GR_CMD_LINE_OPTIONS_WRONG;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
return global_ret;
}
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index 9696ab21..6113152a 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -1635,10 +1635,10 @@ main (int argc,
ret = GNUNET_GETOPT_run ("taler-exchange-httpd",
options,
argc, argv);
- if (ret < 0)
- return 1;
- if (0 == ret)
- return 0;
+ if (GNUNET_SYSERR == ret)
+ return EXIT_INVALIDARGUMENT;
+ if (GNUNET_NO == ret)
+ return EXIT_SUCCESS;
if (0 == num_threads)
{
cpu_set_t mask;
@@ -1669,12 +1669,12 @@ main (int argc,
"Malformed configuration file `%s', exit ...\n",
cfgfile);
GNUNET_free (cfgfile);
- return 1;
+ return EXIT_NOTCONFIGURED;
}
GNUNET_free (cfgfile);
if (GNUNET_OK !=
exchange_serve_process_config ())
- return 1;
+ return EXIT_NOTCONFIGURED;
TEH_load_terms (TEH_cfg);
/* check for systemd-style FD passing */
@@ -1715,10 +1715,10 @@ main (int argc,
/* initialize #internal_key_state with an RC of 1 */
if (GNUNET_OK !=
TEH_WIRE_init ())
- return 42;
+ return EXIT_FAILURE;
if (GNUNET_OK !=
TEH_keys_init ())
- return 43;
+ return EXIT_FAILURE;
ret = TEH_loop_init ();
if (GNUNET_OK == ret)
{
@@ -1737,7 +1737,7 @@ main (int argc,
fh = TALER_MHD_open_unix_path (serve_unixpath,
unixpath_mode);
if (-1 == fh)
- return 1;
+ return EXIT_NOPERMISSION; /* at least most likely */
}
ret = run_main_loop (fh,
argv);
diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c
index 370aed6c..a416eb15 100644
--- a/src/exchange/taler-exchange-transfer.c
+++ b/src/exchange/taler-exchange-transfer.c
@@ -99,21 +99,7 @@ static struct GNUNET_TIME_Relative aggregator_idle_sleep_interval;
/**
* Value to return from main(). 0 on success, non-zero on errors.
*/
-static enum
-{
- GR_SUCCESS = 0,
- GR_WIRE_TRANSFER_FAILED = 1,
- GR_DATABASE_COMMIT_HARD_FAIL = 2,
- GR_INVARIANT_FAILURE = 3,
- GR_WIRE_ACCOUNT_NOT_CONFIGURED = 4,
- GR_WIRE_TRANSFER_BEGIN_FAIL = 5,
- GR_DATABASE_TRANSACTION_BEGIN_FAIL = 6,
- GR_DATABASE_SESSION_START_FAIL = 7,
- GR_CONFIGURATION_INVALID = 8,
- GR_CMD_LINE_UTF8_ERROR = 9,
- GR_CMD_LINE_OPTIONS_WRONG = 10,
- GR_DATABASE_FETCH_FAILURE = 11,
-} global_ret;
+static int global_ret;
/**
* #GNUNET_YES if we are in test mode and should exit when idle.
@@ -290,7 +276,7 @@ wire_confirm_cb (void *cls,
ec);
db_plugin->rollback (db_plugin->cls,
session);
- global_ret = GR_WIRE_TRANSFER_FAILED;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
GNUNET_free (wpd);
wpd = NULL;
@@ -310,7 +296,7 @@ wire_confirm_cb (void *cls,
}
else
{
- global_ret = GR_DATABASE_COMMIT_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
}
GNUNET_free (wpd);
@@ -329,7 +315,7 @@ wire_confirm_cb (void *cls,
return;
case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0);
- global_ret = GR_DATABASE_COMMIT_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
@@ -343,7 +329,7 @@ wire_confirm_cb (void *cls,
return;
default:
GNUNET_break (0);
- global_ret = GR_INVARIANT_FAILURE;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -376,7 +362,7 @@ wire_prepare_cb (void *cls,
GNUNET_break (0);
db_plugin->rollback (db_plugin->cls,
wpd->session);
- global_ret = GR_DATABASE_FETCH_FAILURE;
+ global_ret = EXIT_FAILURE;
goto cleanup;
}
wpd->row_id = rowid;
@@ -391,7 +377,7 @@ wire_prepare_cb (void *cls,
GNUNET_break (0);
db_plugin->rollback (db_plugin->cls,
wpd->session);
- global_ret = GR_WIRE_ACCOUNT_NOT_CONFIGURED;
+ global_ret = EXIT_NOTCONFIGURED;
goto cleanup;
}
wa = wpd->wa;
@@ -406,7 +392,7 @@ wire_prepare_cb (void *cls,
GNUNET_break (0); /* Irrecoverable */
db_plugin->rollback (db_plugin->cls,
wpd->session);
- global_ret = GR_WIRE_TRANSFER_BEGIN_FAIL;
+ global_ret = EXIT_FAILURE;
goto cleanup;
}
return;
@@ -437,7 +423,7 @@ run_transfers (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n");
- global_ret = GR_DATABASE_SESSION_START_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -448,7 +434,7 @@ run_transfers (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n");
- global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -468,7 +454,7 @@ run_transfers (void *cls)
{
case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0);
- global_ret = GR_DATABASE_COMMIT_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
case GNUNET_DB_STATUS_SOFT_ERROR:
@@ -524,7 +510,7 @@ run (void *cls,
if (GNUNET_OK != parse_wirewatch_config ())
{
cfg = NULL;
- global_ret = GR_CONFIGURATION_INVALID;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
@@ -570,7 +556,7 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
- return GR_CMD_LINE_UTF8_ERROR;
+ return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run (
argc, argv,
"taler-exchange-transfer",
@@ -580,9 +566,9 @@ main (int argc,
&run, NULL);
GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
- return GR_CMD_LINE_OPTIONS_WRONG;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
return global_ret;
}
diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c
index 4cdba640..eeb1af48 100644
--- a/src/exchange/taler-exchange-wirewatch.c
+++ b/src/exchange/taler-exchange-wirewatch.c
@@ -198,17 +198,7 @@ static unsigned int max_workers = 16;
* Value to return from main(). 0 on success, non-zero on
* on serious errors.
*/
-static enum
-{
- GR_SUCCESS = 0,
- GR_DATABASE_SESSION_FAIL = 1,
- GR_DATABASE_TRANSACTION_BEGIN_FAIL = 2,
- GR_DATABASE_SELECT_LATEST_HARD_FAIL = 3,
- GR_BANK_REQUEST_HISTORY_FAIL = 4,
- GR_CONFIGURATION_INVALID = 5,
- GR_CMD_LINE_UTF8_ERROR = 6,
- GR_CMD_LINE_OPTIONS_WRONG = 7,
-} global_ret;
+static int global_ret;
/**
* Are we run in testing mode and should only do one pass?
@@ -616,7 +606,7 @@ find_transfers (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n");
- global_ret = GR_DATABASE_SESSION_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -650,7 +640,7 @@ find_transfers (void *cls)
case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain starting point for montoring from database!\n");
- global_ret = GR_DATABASE_SELECT_LATEST_HARD_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
case GNUNET_DB_STATUS_SOFT_ERROR:
@@ -683,7 +673,7 @@ find_transfers (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n");
- global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -704,7 +694,7 @@ find_transfers (void *cls)
"Failed to start request for account history!\n");
db_plugin->rollback (db_plugin->cls,
session);
- global_ret = GR_BANK_REQUEST_HISTORY_FAIL;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -733,7 +723,7 @@ run (void *cls,
if (GNUNET_OK !=
exchange_serve_process_config ())
{
- global_ret = GR_CONFIGURATION_INVALID;
+ global_ret = EXIT_NOTCONFIGURED;
return;
}
wa_pos = wa_head;
@@ -789,7 +779,7 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
- return GR_CMD_LINE_UTF8_ERROR;
+ return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run (
argc, argv,
"taler-exchange-wirewatch",
@@ -799,9 +789,9 @@ main (int argc,
&run, NULL);
GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
- return GR_CMD_LINE_OPTIONS_WRONG;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
return global_ret;
}
diff --git a/src/include/platform.h b/src/include/platform.h
index ba3a4d2c..109c3a75 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -66,6 +66,33 @@
is needed for performance reasons. */
#define ENABLE_SANITY_CHECKS 1
+
+/* LSB-style exit status codes */
+#ifndef EXIT_INVALIDARGUMENT
+#define EXIT_INVALIDARGUMENT 2
+#endif
+
+#ifndef EXIT_NOTIMPLEMENTED
+#define EXIT_NOTIMPLEMENTED 3
+#endif
+
+#ifndef EXIT_NOPERMISSION
+#define EXIT_NOPERMISSION 4
+#endif
+
+#ifndef EXIT_NOTINSTALLED
+#define EXIT_NOTINSTALLED 5
+#endif
+
+#ifndef EXIT_NOTCONFIGURED
+#define EXIT_NOTCONFIGURED 6
+#endif
+
+#ifndef EXIT_NOTRUNNING
+#define EXIT_NOTRUNNING 7
+#endif
+
+
#endif /* PLATFORM_H_ */
/* end of platform.h */
diff --git a/src/json/Makefile.am b/src/json/Makefile.am
index cad3b248..d3e4339f 100644
--- a/src/json/Makefile.am
+++ b/src/json/Makefile.am
@@ -17,10 +17,10 @@ libtalerjson_la_SOURCES = \
json_wire.c
libtalerjson_la_LDFLAGS = \
-version-info 1:0:1 \
- -export-dynamic -no-undefined
+ -no-undefined
libtalerjson_la_LIBADD = \
- -lgnunetjson \
$(top_builddir)/src/util/libtalerutil.la \
+ -lgnunetjson \
-lgnunetutil \
-ljansson \
-lm \
diff --git a/src/mhd/Makefile.am b/src/mhd/Makefile.am
index 797dc873..059c275c 100644
--- a/src/mhd/Makefile.am
+++ b/src/mhd/Makefile.am
@@ -16,7 +16,7 @@ libtalermhd_la_SOURCES = \
mhd_responses.c
libtalermhd_la_LDFLAGS = \
-version-info 0:0:0 \
- -export-dynamic -no-undefined
+ -no-undefined
libtalermhd_la_LIBADD = \
-lgnunetjson \
$(top_builddir)/src/json/libtalerjson.la \
diff --git a/src/pq/Makefile.am b/src/pq/Makefile.am
index 3082e0b4..b0717dfc 100644
--- a/src/pq/Makefile.am
+++ b/src/pq/Makefile.am
@@ -20,7 +20,7 @@ libtalerpq_la_LIBADD = \
libtalerpq_la_LDFLAGS = \
$(POSTGRESQL_LDFLAGS) \
-version-info 0:0:0 \
- -export-dynamic -no-undefined
+ -no-undefined
check_PROGRAMS= \
test_pq
diff --git a/src/sq/Makefile.am b/src/sq/Makefile.am
index 93948e77..f27dec3d 100644
--- a/src/sq/Makefile.am
+++ b/src/sq/Makefile.am
@@ -20,7 +20,7 @@ libtalersq_la_LIBADD = \
libtalersq_la_LDFLAGS = \
$(SQLITE_LDFLAGS) \
-version-info 0:0:0 \
- -export-dynamic -no-undefined
+ -no-undefined
check_PROGRAMS= \
test_sq
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 7a6f3d6e..47eafb6a 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -89,7 +89,7 @@ libtalerutil_la_LIBADD = \
libtalerutil_la_LDFLAGS = \
-version-info 0:0:0 \
- -export-dynamic -no-undefined
+ -no-undefined
AM_TESTS_ENVIRONMENT=export TALER_PREFIX=$${TALER_PREFIX:-@libdir@};export PATH=$${TALER_PREFIX:-@prefix@}/bin:$$PATH;