This commit is contained in:
Christian Grothoff 2021-07-29 23:56:46 +02:00
parent 1b419adab4
commit 0ef7c0a0b7
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
19 changed files with 236 additions and 259 deletions

View File

@ -130,8 +130,8 @@ taler_helper_auditor_wire_SOURCES = \
taler-helper-auditor-wire.c taler-helper-auditor-wire.c
taler_helper_auditor_wire_LDADD = \ taler_helper_auditor_wire_LDADD = \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/json/libtalerjson.la \ $(top_builddir)/src/json/libtalerjson.la \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/bank-lib/libtalerbank.la \ $(top_builddir)/src/bank-lib/libtalerbank.la \
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \ $(top_builddir)/src/exchangedb/libtalerexchangedb.la \
$(top_builddir)/src/auditordb/libtalerauditordb.la \ $(top_builddir)/src/auditordb/libtalerauditordb.la \
@ -174,11 +174,13 @@ taler_auditor_exchange_LDADD = \
taler_auditor_sync_SOURCES = \ taler_auditor_sync_SOURCES = \
taler-auditor-sync.c taler-auditor-sync.c
taler_auditor_sync_LDADD = \ 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/exchangedb/libtalerexchangedb.la \
$(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/json/libtalerjson.la \
$(top_builddir)/src/util/libtalerutil.la \
-lgnunetjson \
-lgnunetutil \ -lgnunetutil \
$(LIBGCRYPT_LIBS) \
$(XLIB) $(XLIB)
taler_auditor_sync_LDFLAGS = \ taler_auditor_sync_LDFLAGS = \
$(POSTGRESQL_LDFLAGS) $(POSTGRESQL_LDFLAGS)

View File

@ -69,7 +69,7 @@ run (void *cls,
{ {
fprintf (stderr, fprintf (stderr,
"Failed to initialize database plugin.\n"); "Failed to initialize database plugin.\n");
global_ret = 1; global_ret = EXIT_NOTINSTALLED;
return; return;
} }
if (reset_db) if (reset_db)
@ -94,7 +94,7 @@ run (void *cls,
fprintf (stderr, fprintf (stderr,
"Failed to initialize database.\n"); "Failed to initialize database.\n");
TALER_AUDITORDB_plugin_unload (plugin); TALER_AUDITORDB_plugin_unload (plugin);
global_ret = 1; global_ret = EXIT_NOPERMISSION;
return; return;
} }
if (gc_db) if (gc_db)
@ -143,7 +143,7 @@ main (int argc,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv, GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv)) &argc, &argv))
return 4; return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run ( ret = GNUNET_PROGRAM_run (
argc, argv, argc, argv,
"taler-auditor-dbinit", "taler-auditor-dbinit",
@ -152,9 +152,9 @@ main (int argc,
&run, NULL); &run, NULL);
GNUNET_free_nz ((void *) argv); GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return 3; return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
return global_ret; return global_ret;
} }

View File

@ -99,9 +99,9 @@ main (int argc,
options, options,
argc, argv); argc, argv);
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return 1; return EXIT_INVALIDARGUMENT;
} }
if (NULL == cfgfile) if (NULL == cfgfile)
cfgfile = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); cfgfile = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file);
@ -119,7 +119,7 @@ main (int argc,
"Malformed configuration file `%s', exit ...\n", "Malformed configuration file `%s', exit ...\n",
cfgfile); cfgfile);
GNUNET_free (cfgfile); GNUNET_free (cfgfile);
return 1; return EXIT_NOTCONFIGURED;
} }
GNUNET_free (cfgfile); GNUNET_free (cfgfile);
@ -131,7 +131,7 @@ main (int argc,
_ ("Missing either `%s' or `%s'.\n"), _ ("Missing either `%s' or `%s'.\n"),
"-u URL", "-u URL",
"--remove"); "--remove");
return 1; return EXIT_INVALIDARGUMENT;
} }
if ( (0 == strlen (exchange_url)) || if ( (0 == strlen (exchange_url)) ||
( (0 != strncasecmp ("http://", ( (0 != strncasecmp ("http://",
@ -144,7 +144,7 @@ main (int argc,
{ {
fprintf (stderr, fprintf (stderr,
"Exchange URL must begin with `http://` or `https://` and end with `/'\n"); "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, fprintf (stderr,
"Failed to initialize auditor database plugin.\n"); "Failed to initialize auditor database plugin.\n");
return 3; return EXIT_NOTINSTALLED;
} }
/* Create required tables */ /* Create required tables */
@ -164,7 +164,7 @@ main (int argc,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to create tables in auditor's database\n"); "Failed to create tables in auditor's database\n");
TALER_AUDITORDB_plugin_unload (adb); TALER_AUDITORDB_plugin_unload (adb);
return 3; return EXIT_NOPERMISSION;
} }
/* Update DB */ /* Update DB */
@ -178,7 +178,7 @@ main (int argc,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to initialize database session\n"); "Failed to initialize database session\n");
TALER_AUDITORDB_plugin_unload (adb); TALER_AUDITORDB_plugin_unload (adb);
return 3; return EXIT_FAILURE;
} }
if (remove_flag) if (remove_flag)
@ -200,7 +200,7 @@ main (int argc,
"Failed to update auditor database (status code: %d)\n", "Failed to update auditor database (status code: %d)\n",
qs); qs);
TALER_AUDITORDB_plugin_unload (adb); TALER_AUDITORDB_plugin_unload (adb);
return 3; return EXIT_FAILURE;
} }
if (0 == qs) if (0 == qs)
{ {
@ -210,11 +210,11 @@ main (int argc,
? "Could not remove exchange from database: entry already absent\n" ? "Could not remove exchange from database: entry already absent\n"
: "Could not add exchange to database: entry already exists\n"); : "Could not add exchange to database: entry already exists\n");
TALER_AUDITORDB_plugin_unload (adb); TALER_AUDITORDB_plugin_unload (adb);
return 4; return EXIT_FAILURE;
} }
} }
TALER_AUDITORDB_plugin_unload (adb); TALER_AUDITORDB_plugin_unload (adb);
return 0; return EXIT_SUCCESS;
} }

View File

@ -576,9 +576,9 @@ main (int argc,
options, options,
argc, argv); argc, argv);
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return 3; return EXIT_FAILURE;
} }
go = TALER_MHD_GO_NONE; go = TALER_MHD_GO_NONE;
if (auditor_connection_close) if (auditor_connection_close)
@ -599,13 +599,13 @@ main (int argc,
"Malformed configuration file `%s', exiting ...\n", "Malformed configuration file `%s', exiting ...\n",
cfgfile); cfgfile);
GNUNET_free (cfgfile); GNUNET_free (cfgfile);
return 1; return EXIT_NOTCONFIGURED;
} }
GNUNET_free (cfgfile); GNUNET_free (cfgfile);
if (GNUNET_OK != if (GNUNET_OK !=
auditor_serve_process_config ()) auditor_serve_process_config ())
return 1; return EXIT_NOTCONFIGURED;
TEAH_DEPOSIT_CONFIRMATION_init (); TEAH_DEPOSIT_CONFIRMATION_init ();
/* check for systemd-style FD passing */ /* check for systemd-style FD passing */
listen_pid = getenv ("LISTEN_PID"); listen_pid = getenv ("LISTEN_PID");
@ -649,7 +649,7 @@ main (int argc,
if (-1 == fh) if (-1 == fh)
{ {
TEAH_DEPOSIT_CONFIRMATION_done (); 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, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start HTTP server.\n"); "Failed to start HTTP server.\n");
TEAH_DEPOSIT_CONFIRMATION_done (); TEAH_DEPOSIT_CONFIRMATION_done ();
return 1; return EXIT_FAILURE;
} }
/* normal behavior */ /* normal behavior */
@ -751,7 +751,7 @@ main (int argc,
TALER_EXCHANGEDB_plugin_unload (TAH_eplugin); TALER_EXCHANGEDB_plugin_unload (TAH_eplugin);
TAH_eplugin = NULL; TAH_eplugin = NULL;
TEAH_DEPOSIT_CONFIRMATION_done (); TEAH_DEPOSIT_CONFIRMATION_done ();
return (GNUNET_SYSERR == ret) ? 1 : 0; return (GNUNET_SYSERR == ret) ? EXIT_FAILURE : EXIT_SUCCESS;
} }

View File

@ -269,7 +269,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to lookup records from table %d: hard error\n", "Failed to lookup records from table %d: hard error\n",
i); i);
global_ret = 3; global_ret = EXIT_FAILURE;
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_DB_STATUS_SOFT_ERROR == qs) 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", "Failed to lookup records from table %d: no results\n",
i); i);
GNUNET_break (0); /* should be impossible */ GNUNET_break (0); /* should be impossible */
global_ret = 4; global_ret = EXIT_FAILURE;
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (0 == ctx.qs) if (0 == ctx.qs)
@ -306,7 +306,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Hard error committing transaction on table %d\n", "Hard error committing transaction on table %d\n",
i); i);
global_ret = 5; global_ret = EXIT_FAILURE;
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
} }
@ -530,13 +530,13 @@ setup (struct GNUNET_CONFIGURATION_Handle *src_cfg,
src = TALER_EXCHANGEDB_plugin_load (src_cfg); src = TALER_EXCHANGEDB_plugin_load (src_cfg);
if (NULL == src) if (NULL == src)
{ {
global_ret = 3; global_ret = EXIT_NOTINSTALLED;
return; return;
} }
dst = TALER_EXCHANGEDB_plugin_load (dst_cfg); dst = TALER_EXCHANGEDB_plugin_load (dst_cfg);
if (NULL == dst) if (NULL == dst)
{ {
global_ret = 3; global_ret = EXIT_NOTINSTALLED;
TALER_EXCHANGEDB_plugin_unload (src); TALER_EXCHANGEDB_plugin_unload (src);
src = NULL; src = NULL;
return; return;
@ -601,9 +601,9 @@ main (int argc,
options, options,
argc, argv); argc, argv);
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return 1; return EXIT_INVALIDARGUMENT;
} }
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_log_setup ("taler-auditor-sync", GNUNET_log_setup ("taler-auditor-sync",
@ -615,14 +615,14 @@ main (int argc,
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Source and destination configuration files must differ!\n"); "Source and destination configuration files must differ!\n");
return 1; return EXIT_INVALIDARGUMENT;
} }
src_cfg = load_config (src_cfgfile); src_cfg = load_config (src_cfgfile);
if (NULL == src_cfg) if (NULL == src_cfg)
{ {
GNUNET_free (src_cfgfile); GNUNET_free (src_cfgfile);
GNUNET_free (dst_cfgfile); GNUNET_free (dst_cfgfile);
return 1; return EXIT_NOTCONFIGURED;
} }
dst_cfg = load_config (dst_cfgfile); dst_cfg = load_config (dst_cfgfile);
if (NULL == dst_cfg) if (NULL == dst_cfg)
@ -630,7 +630,7 @@ main (int argc,
GNUNET_CONFIGURATION_destroy (src_cfg); GNUNET_CONFIGURATION_destroy (src_cfg);
GNUNET_free (src_cfgfile); GNUNET_free (src_cfgfile);
GNUNET_free (dst_cfgfile); GNUNET_free (dst_cfgfile);
return 1; return EXIT_NOTCONFIGURED;
} }
setup (src_cfg, setup (src_cfg,
dst_cfg); dst_cfg);

View File

@ -407,7 +407,7 @@ denomination_add_cb (
NULL != hr->hint NULL != hr->hint
? hr->hint ? hr->hint
: "no hint provided"); : "no hint provided");
global_ret = 42; global_ret = EXIT_FAILURE;
} }
GNUNET_CONTAINER_DLL_remove (dar_head, GNUNET_CONTAINER_DLL_remove (dar_head,
dar_tail, dar_tail,
@ -453,7 +453,7 @@ upload_denomination_add (const char *exchange_url,
err_name, err_name,
err_line, err_line,
(unsigned int) idx); (unsigned int) idx);
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -505,7 +505,7 @@ trigger_upload (const char *exchange_url)
{ {
fprintf (stderr, fprintf (stderr,
"Malformed JSON input\n"); "Malformed JSON input\n");
global_ret = 3; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -527,7 +527,7 @@ trigger_upload (const char *exchange_url)
fprintf (stderr, fprintf (stderr,
"Upload does not know how to handle `%s'\n", "Upload does not know how to handle `%s'\n",
key); key);
global_ret = 3; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -561,7 +561,7 @@ do_upload (char *const *args)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"auditor", "auditor",
"PUBLIC_KEY"); "PUBLIC_KEY");
global_ret = 4; global_ret = EXIT_NOTCONFIGURED;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -576,7 +576,7 @@ do_upload (char *const *args)
"PUBLIC_KEY", "PUBLIC_KEY",
"invalid key"); "invalid key");
GNUNET_free (auditor_public_key_str); GNUNET_free (auditor_public_key_str);
global_ret = 4; global_ret = EXIT_NOTCONFIGURED;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -587,7 +587,7 @@ do_upload (char *const *args)
fprintf (stderr, fprintf (stderr,
"Downloaded data was not consumed, refusing upload\n"); "Downloaded data was not consumed, refusing upload\n");
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
if (NULL == out) if (NULL == out)
@ -606,7 +606,7 @@ do_upload (char *const *args)
err.source, err.source,
err.position); err.position);
test_shutdown (); test_shutdown ();
global_ret = 2; global_ret = EXIT_FAILURE;
return; return;
} }
} }
@ -615,7 +615,7 @@ do_upload (char *const *args)
fprintf (stderr, fprintf (stderr,
"Error: expected JSON array for `upload` command\n"); "Error: expected JSON array for `upload` command\n");
test_shutdown (); test_shutdown ();
global_ret = 2; global_ret = EXIT_FAILURE;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -627,7 +627,7 @@ do_upload (char *const *args)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange", "exchange",
"BASE_URL"); "BASE_URL");
global_ret = 1; global_ret = EXIT_NOTCONFIGURED;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -670,7 +670,7 @@ keys_cb (
TALER_EXCHANGE_disconnect (exchange); TALER_EXCHANGE_disconnect (exchange);
exchange = NULL; exchange = NULL;
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
in = json_pack ("{s:s,s:O}", in = json_pack ("{s:s,s:O}",
@ -712,7 +712,7 @@ do_download (char *const *args)
"exchange", "exchange",
"BASE_URL"); "BASE_URL");
test_shutdown (); test_shutdown ();
global_ret = 1; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
exchange = TALER_EXCHANGE_connect (ctx, exchange = TALER_EXCHANGE_connect (ctx,
@ -795,7 +795,7 @@ show_denomkeys (const json_t *denomkeys)
err_line, err_line,
(unsigned int) index); (unsigned int) index);
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -821,7 +821,7 @@ show_denomkeys (const json_t *denomkeys)
fprintf (stderr, fprintf (stderr,
"Invalid master signature for key %s (aborting)\n", "Invalid master signature for key %s (aborting)\n",
TALER_B2S (&h_denom_pub)); TALER_B2S (&h_denom_pub));
global_ret = 9; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -907,7 +907,7 @@ parse_keys (const char *command_name)
err.line, err.line,
err.source, err.source,
err.position); err.position);
global_ret = 2; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return NULL; return NULL;
} }
@ -926,7 +926,7 @@ parse_keys (const char *command_name)
json_dumpf (in, json_dumpf (in,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return NULL; return NULL;
} }
@ -985,7 +985,7 @@ do_show (char *const *args)
"Invalid input to 'show': %s#%u (skipping)\n", "Invalid input to 'show': %s#%u (skipping)\n",
err_name, err_name,
err_line); err_line);
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
json_decref (keys); json_decref (keys);
return; return;
@ -996,7 +996,7 @@ do_show (char *const *args)
{ {
fprintf (stderr, fprintf (stderr,
"Exchange master public key does not match key we have configured (aborting)\n"); "Exchange master public key does not match key we have configured (aborting)\n");
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
json_decref (keys); json_decref (keys);
return; return;
@ -1004,7 +1004,7 @@ do_show (char *const *args)
if (GNUNET_OK != if (GNUNET_OK !=
show_denomkeys (denomkeys)) show_denomkeys (denomkeys))
{ {
global_ret = 8; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
json_decref (keys); json_decref (keys);
@ -1094,7 +1094,7 @@ sign_denomkeys (const json_t *denomkeys)
err_line, err_line,
(unsigned int) index); (unsigned int) index);
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -1118,7 +1118,7 @@ sign_denomkeys (const json_t *denomkeys)
fprintf (stderr, fprintf (stderr,
"Invalid master signature for key %s (aborting)\n", "Invalid master signature for key %s (aborting)\n",
TALER_B2S (&h_denom_pub)); TALER_B2S (&h_denom_pub));
global_ret = 9; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -1197,7 +1197,7 @@ do_sign (char *const *args)
"Invalid input to 'sign': %s#%u (skipping)\n", "Invalid input to 'sign': %s#%u (skipping)\n",
err_name, err_name,
err_line); err_line);
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
json_decref (keys); json_decref (keys);
return; return;
@ -1208,7 +1208,7 @@ do_sign (char *const *args)
{ {
fprintf (stderr, fprintf (stderr,
"Exchange master public key does not match key we have configured (aborting)\n"); "Exchange master public key does not match key we have configured (aborting)\n");
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
json_decref (keys); json_decref (keys);
return; return;
@ -1218,7 +1218,7 @@ do_sign (char *const *args)
if (GNUNET_OK != if (GNUNET_OK !=
sign_denomkeys (denomkeys)) sign_denomkeys (denomkeys))
{ {
global_ret = 8; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
json_decref (keys); json_decref (keys);
@ -1241,7 +1241,7 @@ do_setup (char *const *args)
if (GNUNET_OK != if (GNUNET_OK !=
load_offline_key (GNUNET_YES)) load_offline_key (GNUNET_YES))
{ {
global_ret = 1; global_ret = EXIT_FAILURE;
return; return;
} }
if (NULL != *args) if (NULL != *args)
@ -1332,7 +1332,7 @@ work (void *cls)
fprintf (stderr, fprintf (stderr,
"Unexpected command `%s'\n", "Unexpected command `%s'\n",
args[0]); args[0]);
global_ret = 3; global_ret = EXIT_INVALIDARGUMENT;
} }
fprintf (stderr, fprintf (stderr,
"Supported subcommands:\n"); "Supported subcommands:\n");
@ -1365,7 +1365,7 @@ run (void *cls,
TALER_config_get_currency (kcfg, TALER_config_get_currency (kcfg,
&currency)) &currency))
{ {
global_ret = 1; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -1377,7 +1377,7 @@ run (void *cls,
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"auditor", "auditor",
"BASE_URL"); "BASE_URL");
global_ret = 1; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
{ {
@ -1392,7 +1392,7 @@ run (void *cls,
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange", "exchange",
"MASTER_PUBLIC_KEY"); "MASTER_PUBLIC_KEY");
global_ret = 1; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -1404,7 +1404,7 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid master public key given in exchange configuration."); "Invalid master public key given in exchange configuration.");
GNUNET_free (master_public_key_str); GNUNET_free (master_public_key_str);
global_ret = 1; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
GNUNET_free (master_public_key_str); GNUNET_free (master_public_key_str);
@ -1446,7 +1446,7 @@ main (int argc,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv, GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv)) &argc, &argv))
return 4; return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run ( ret = GNUNET_PROGRAM_run (
argc, argv, argc, argv,
"taler-auditor-offline", "taler-auditor-offline",
@ -1455,9 +1455,9 @@ main (int argc,
&run, NULL); &run, NULL);
GNUNET_free_nz ((void *) argv); GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return 3; return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
return global_ret; return global_ret;
} }

View File

@ -38,6 +38,7 @@ static int reset_db;
*/ */
static int gc_db; static int gc_db;
/** /**
* Main function that will be run. * Main function that will be run.
* *
@ -62,7 +63,7 @@ run (void *cls,
{ {
fprintf (stderr, fprintf (stderr,
"Failed to initialize database plugin.\n"); "Failed to initialize database plugin.\n");
global_ret = 1; global_ret = EXIT_NOTINSTALLED;
return; return;
} }
if (reset_db) if (reset_db)
@ -79,7 +80,7 @@ run (void *cls,
fprintf (stderr, fprintf (stderr,
"Failed to initialize database.\n"); "Failed to initialize database.\n");
TALER_EXCHANGEDB_plugin_unload (plugin); TALER_EXCHANGEDB_plugin_unload (plugin);
global_ret = 1; global_ret = EXIT_NOPERMISSION;
return; return;
} }
if (gc_db) if (gc_db)
@ -126,7 +127,7 @@ main (int argc,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv, GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv)) &argc, &argv))
return 4; return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run ( ret = GNUNET_PROGRAM_run (
argc, argv, argc, argv,
"taler-exchange-dbinit", "taler-exchange-dbinit",
@ -135,9 +136,9 @@ main (int argc,
&run, NULL); &run, NULL);
GNUNET_free_nz ((void *) argv); GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return 3; return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
return global_ret; return global_ret;
} }

View File

@ -821,7 +821,7 @@ denom_revocation_cb (
hr->http_status, hr->http_status,
hr->hint, hr->hint,
TALER_JSON_get_error_hint (hr->reply)); TALER_JSON_get_error_hint (hr->reply));
global_ret = 10; global_ret = EXIT_FAILURE;
} }
GNUNET_CONTAINER_DLL_remove (drr_head, GNUNET_CONTAINER_DLL_remove (drr_head,
drr_tail, drr_tail,
@ -870,7 +870,7 @@ upload_denom_revocation (const char *exchange_url,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -910,7 +910,7 @@ signkey_revocation_cb (
hr->http_status, hr->http_status,
hr->hint, hr->hint,
TALER_JSON_get_error_hint (hr->reply)); TALER_JSON_get_error_hint (hr->reply));
global_ret = 10; global_ret = EXIT_FAILURE;
} }
GNUNET_CONTAINER_DLL_remove (srr_head, GNUNET_CONTAINER_DLL_remove (srr_head,
srr_tail, srr_tail,
@ -959,7 +959,7 @@ upload_signkey_revocation (const char *exchange_url,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -998,7 +998,7 @@ auditor_add_cb (void *cls,
hr->http_status, hr->http_status,
TALER_ErrorCode_get_hint (hr->ec), TALER_ErrorCode_get_hint (hr->ec),
hr->hint); hr->hint);
global_ret = 10; global_ret = EXIT_FAILURE;
} }
GNUNET_CONTAINER_DLL_remove (aar_head, GNUNET_CONTAINER_DLL_remove (aar_head,
aar_tail, aar_tail,
@ -1056,7 +1056,7 @@ upload_auditor_add (const char *exchange_url,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1098,7 +1098,7 @@ auditor_del_cb (void *cls,
hr->http_status, hr->http_status,
TALER_ErrorCode_get_hint (hr->ec), TALER_ErrorCode_get_hint (hr->ec),
hr->hint); hr->hint);
global_ret = 10; global_ret = EXIT_FAILURE;
} }
GNUNET_CONTAINER_DLL_remove (adr_head, GNUNET_CONTAINER_DLL_remove (adr_head,
adr_tail, adr_tail,
@ -1150,7 +1150,7 @@ upload_auditor_del (const char *exchange_url,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1190,7 +1190,7 @@ wire_add_cb (void *cls,
hr->http_status, hr->http_status,
TALER_ErrorCode_get_hint (hr->ec), TALER_ErrorCode_get_hint (hr->ec),
hr->hint); hr->hint);
global_ret = 10; global_ret = EXIT_FAILURE;
} }
GNUNET_CONTAINER_DLL_remove (war_head, GNUNET_CONTAINER_DLL_remove (war_head,
war_tail, war_tail,
@ -1245,7 +1245,7 @@ upload_wire_add (const char *exchange_url,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1258,7 +1258,7 @@ upload_wire_add (const char *exchange_url,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"payto:// URI `%s' is malformed\n", "payto:// URI `%s' is malformed\n",
payto_uri); payto_uri);
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1301,7 +1301,7 @@ wire_del_cb (void *cls,
hr->http_status, hr->http_status,
TALER_ErrorCode_get_hint (hr->ec), TALER_ErrorCode_get_hint (hr->ec),
hr->hint); hr->hint);
global_ret = 10; global_ret = EXIT_FAILURE;
} }
GNUNET_CONTAINER_DLL_remove (wdr_head, GNUNET_CONTAINER_DLL_remove (wdr_head,
wdr_tail, wdr_tail,
@ -1353,7 +1353,7 @@ upload_wire_del (const char *exchange_url,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1394,7 +1394,7 @@ wire_fee_cb (
hr->http_status, hr->http_status,
TALER_ErrorCode_get_hint (hr->ec), TALER_ErrorCode_get_hint (hr->ec),
hr->hint); hr->hint);
global_ret = 10; global_ret = EXIT_FAILURE;
} }
GNUNET_CONTAINER_DLL_remove (wfr_head, GNUNET_CONTAINER_DLL_remove (wfr_head,
wfr_tail, wfr_tail,
@ -1457,7 +1457,7 @@ upload_wire_fee (const char *exchange_url,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1501,7 +1501,7 @@ keys_cb (
hr->http_status, hr->http_status,
TALER_ErrorCode_get_hint (hr->ec), TALER_ErrorCode_get_hint (hr->ec),
hr->hint); hr->hint);
global_ret = 10; global_ret = EXIT_FAILURE;
} }
GNUNET_CONTAINER_DLL_remove (ukr_head, GNUNET_CONTAINER_DLL_remove (ukr_head,
ukr_tail, ukr_tail,
@ -1551,7 +1551,7 @@ upload_keys (const char *exchange_url,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1644,7 +1644,7 @@ upload_keys (const char *exchange_url,
} }
else else
{ {
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
} }
GNUNET_free (pkd.sign_sigs); GNUNET_free (pkd.sign_sigs);
@ -1713,7 +1713,7 @@ trigger_upload (const char *exchange_url)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed JSON input\n"); "Malformed JSON input\n");
global_ret = 3; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1735,7 +1735,7 @@ trigger_upload (const char *exchange_url)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload does not know how to handle `%s'\n", "Upload does not know how to handle `%s'\n",
key); key);
global_ret = 3; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1758,7 +1758,7 @@ do_upload (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, refusing upload\n"); "Downloaded data was not consumed, refusing upload\n");
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
if (NULL == out) if (NULL == out)
@ -1777,7 +1777,7 @@ do_upload (char *const *args)
err.source, err.source,
err.position); err.position);
test_shutdown (); test_shutdown ();
global_ret = 2; global_ret = EXIT_FAILURE;
return; return;
} }
} }
@ -1786,7 +1786,7 @@ do_upload (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error: expected JSON array for `upload` command\n"); "Error: expected JSON array for `upload` command\n");
test_shutdown (); test_shutdown ();
global_ret = 2; global_ret = EXIT_FAILURE;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -1798,7 +1798,7 @@ do_upload (char *const *args)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange", "exchange",
"BASE_URL"); "BASE_URL");
global_ret = 1; global_ret = EXIT_NOTCONFIGURED;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -1826,7 +1826,7 @@ do_revoke_denomination_key (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, refusing revocation\n"); "Downloaded data was not consumed, refusing revocation\n");
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
if ( (NULL == args[0]) || if ( (NULL == args[0]) ||
@ -1839,7 +1839,7 @@ do_revoke_denomination_key (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify a denomination key with this subcommand\n"); "You must specify a denomination key with this subcommand\n");
test_shutdown (); test_shutdown ();
global_ret = 5; global_ret = EXIT_INVALIDARGUMENT;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -1875,7 +1875,7 @@ do_revoke_signkey (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, refusing revocation\n"); "Downloaded data was not consumed, refusing revocation\n");
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
if ( (NULL == args[0]) || if ( (NULL == args[0]) ||
@ -1888,7 +1888,7 @@ do_revoke_signkey (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify an exchange signing key with this subcommand\n"); "You must specify an exchange signing key with this subcommand\n");
test_shutdown (); test_shutdown ();
global_ret = 5; global_ret = EXIT_INVALIDARGUMENT;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -1926,7 +1926,7 @@ do_add_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not adding auditor\n"); "Downloaded data was not consumed, not adding auditor\n");
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
if ( (NULL == args[0]) || if ( (NULL == args[0]) ||
@ -1939,7 +1939,7 @@ do_add_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify an auditor public key as first argument for this subcommand\n"); "You must specify an auditor public key as first argument for this subcommand\n");
test_shutdown (); test_shutdown ();
global_ret = 5; global_ret = EXIT_INVALIDARGUMENT;
return; return;
} }
@ -1952,7 +1952,7 @@ do_add_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify an auditor URI and auditor name as 2nd and 3rd arguments to this subcommand\n"); "You must specify an auditor URI and auditor name as 2nd and 3rd arguments to this subcommand\n");
test_shutdown (); test_shutdown ();
global_ret = 5; global_ret = EXIT_INVALIDARGUMENT;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -1999,7 +1999,7 @@ do_del_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not deleting auditor account\n"); "Downloaded data was not consumed, not deleting auditor account\n");
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
if ( (NULL == args[0]) || if ( (NULL == args[0]) ||
@ -2012,7 +2012,7 @@ do_del_auditor (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify an auditor public key as first argument for this subcommand\n"); "You must specify an auditor public key as first argument for this subcommand\n");
test_shutdown (); test_shutdown ();
global_ret = 5; global_ret = EXIT_INVALIDARGUMENT;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -2055,7 +2055,7 @@ do_add_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not adding wire account\n"); "Downloaded data was not consumed, not adding wire account\n");
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
if (NULL == args[0]) if (NULL == args[0])
@ -2063,7 +2063,7 @@ do_add_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify a payto://-URI with this subcommand\n"); "You must specify a payto://-URI with this subcommand\n");
test_shutdown (); test_shutdown ();
global_ret = 5; global_ret = EXIT_INVALIDARGUMENT;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -2081,7 +2081,7 @@ do_add_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"payto:// URI `%s' is malformed\n", "payto:// URI `%s' is malformed\n",
args[0]); args[0]);
global_ret = 7; global_ret = EXIT_INVALIDARGUMENT;
test_shutdown (); test_shutdown ();
return; return;
} }
@ -2125,7 +2125,7 @@ do_del_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not deleting wire account\n"); "Downloaded data was not consumed, not deleting wire account\n");
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
if (NULL == args[0]) if (NULL == args[0])
@ -2133,7 +2133,7 @@ do_del_wire (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify a payto://-URI with this subcommand\n"); "You must specify a payto://-URI with this subcommand\n");
test_shutdown (); test_shutdown ();
global_ret = 5; global_ret = EXIT_INVALIDARGUMENT;
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -2181,7 +2181,7 @@ do_set_wire_fee (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not setting wire fee\n"); "Downloaded data was not consumed, not setting wire fee\n");
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
if ( (NULL == args[0]) || if ( (NULL == args[0]) ||
@ -2204,7 +2204,7 @@ do_set_wire_fee (char *const *args)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must use YEAR, METHOD, WIRE-FEE and CLOSING-FEE as arguments for this subcommand\n"); "You must use YEAR, METHOD, WIRE-FEE and CLOSING-FEE as arguments for this subcommand\n");
test_shutdown (); test_shutdown ();
global_ret = 5; global_ret = EXIT_INVALIDARGUMENT;
return; return;
} }
if (0 == strcasecmp ("now", if (0 == strcasecmp ("now",
@ -2270,7 +2270,7 @@ download_cb (void *cls,
hr->http_status, hr->http_status,
(unsigned int) hr->ec); (unsigned int) hr->ec);
test_shutdown (); test_shutdown ();
global_ret = 4; global_ret = EXIT_FAILURE;
return; return;
} }
in = json_pack ("{s:s,s:O}", in = json_pack ("{s:s,s:O}",
@ -2310,7 +2310,7 @@ do_download (char *const *args)
"exchange", "exchange",
"BASE_URL"); "BASE_URL");
test_shutdown (); test_shutdown ();
global_ret = 1; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
mgkh = TALER_EXCHANGE_get_management_keys (ctx, mgkh = TALER_EXCHANGE_get_management_keys (ctx,
@ -2524,7 +2524,7 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -2540,7 +2540,7 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for signing key %s (aborting)\n", "Invalid security module signature for signing key %s (aborting)\n",
TALER_B2S (&exchange_pub)); TALER_B2S (&exchange_pub));
global_ret = 9; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -2641,7 +2641,7 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -2660,7 +2660,7 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for denomination key %s (aborting)\n", "Invalid security module signature for denomination key %s (aborting)\n",
GNUNET_h2s (&h_denom_pub)); GNUNET_h2s (&h_denom_pub));
global_ret = 9; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -2747,7 +2747,7 @@ parse_keys_input (const char *command_name)
err.line, err.line,
err.source, err.source,
err.position); err.position);
global_ret = 2; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return NULL; return NULL;
} }
@ -2766,7 +2766,7 @@ parse_keys_input (const char *command_name)
json_dumpf (in, json_dumpf (in,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return NULL; return NULL;
} }
@ -2835,7 +2835,7 @@ do_show (char *const *args)
json_dumpf (in, json_dumpf (in,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
json_decref (keys); json_decref (keys);
return; return;
@ -2846,7 +2846,7 @@ do_show (char *const *args)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: exchange uses different master key!\n"); "Fatal: exchange uses different master key!\n");
global_ret = 6; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
json_decref (keys); json_decref (keys);
@ -2855,7 +2855,7 @@ do_show (char *const *args)
if (GNUNET_SYSERR == if (GNUNET_SYSERR ==
tofu_check (secm)) tofu_check (secm))
{ {
global_ret = 8; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
json_decref (keys); json_decref (keys);
@ -2868,7 +2868,7 @@ do_show (char *const *args)
show_denomkeys (&secm[0], show_denomkeys (&secm[0],
denomkeys)) ) denomkeys)) )
{ {
global_ret = 8; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
json_decref (keys); json_decref (keys);
@ -2933,7 +2933,7 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
json_dumpf (value, json_dumpf (value,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -2950,7 +2950,7 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for signing key %s (aborting)\n", "Invalid security module signature for signing key %s (aborting)\n",
TALER_B2S (&exchange_pub)); TALER_B2S (&exchange_pub));
global_ret = 9; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -3060,7 +3060,7 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -3079,7 +3079,7 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for denomination key %s (aborting)\n", "Invalid security module signature for denomination key %s (aborting)\n",
GNUNET_h2s (&h_denom_pub)); GNUNET_h2s (&h_denom_pub));
global_ret = 9; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -3167,7 +3167,7 @@ do_sign (char *const *args)
json_dumpf (in, json_dumpf (in,
stderr, stderr,
JSON_INDENT (2)); JSON_INDENT (2));
global_ret = 7; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
json_decref (keys); json_decref (keys);
return; return;
@ -3178,7 +3178,7 @@ do_sign (char *const *args)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: exchange uses different master key!\n"); "Fatal: exchange uses different master key!\n");
global_ret = 6; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
json_decref (keys); json_decref (keys);
@ -3189,7 +3189,7 @@ do_sign (char *const *args)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: security module keys changed!\n"); "Fatal: security module keys changed!\n");
global_ret = 8; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
json_decref (keys); json_decref (keys);
@ -3210,7 +3210,7 @@ do_sign (char *const *args)
denomkeys, denomkeys,
denomkey_sig_array)) ) denomkey_sig_array)) )
{ {
global_ret = 8; global_ret = EXIT_FAILURE;
test_shutdown (); test_shutdown ();
json_decref (signkey_sig_array); json_decref (signkey_sig_array);
json_decref (denomkey_sig_array); json_decref (denomkey_sig_array);
@ -3243,7 +3243,7 @@ do_setup (char *const *args)
if (GNUNET_OK != if (GNUNET_OK !=
load_offline_key (GNUNET_YES)) load_offline_key (GNUNET_YES))
{ {
global_ret = 1; global_ret = EXIT_NOPERMISSION;
return; return;
} }
if (NULL != *args) if (NULL != *args)
@ -3373,7 +3373,7 @@ work (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"Unexpected command `%s'\n", "Unexpected command `%s'\n",
args[0]); args[0]);
global_ret = 3; global_ret = EXIT_INVALIDARGUMENT;
} }
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"Supported subcommands:\n"); "Supported subcommands:\n");
@ -3406,7 +3406,7 @@ run (void *cls,
TALER_config_get_currency (kcfg, TALER_config_get_currency (kcfg,
&currency)) &currency))
{ {
global_ret = 1; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule, ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
@ -3446,7 +3446,7 @@ main (int argc,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv, GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv)) &argc, &argv))
return 4; return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run ( ret = GNUNET_PROGRAM_run (
argc, argv, argc, argv,
"taler-exchange-offline", "taler-exchange-offline",
@ -3455,9 +3455,9 @@ main (int argc,
&run, NULL); &run, NULL);
GNUNET_free_nz ((void *) argv); GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return 3; return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
return global_ret; return global_ret;
} }

View File

@ -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. * Value to return from main(). 0 on success, non-zero on errors.
*/ */
static enum static int global_ret;
{
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;
/** /**
* #GNUNET_YES if we are in test mode and should exit when idle. * #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, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n"); "Failed to obtain database session!\n");
global_ret = GR_DATABASE_SESSION_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -686,7 +672,7 @@ run_aggregation (void *cls)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n"); "Failed to start database transaction!\n");
global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -707,7 +693,7 @@ run_aggregation (void *cls)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to execute deposit iteration!\n"); "Failed to execute deposit iteration!\n");
global_ret = GR_DATABASE_READY_DEPOSIT_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -756,7 +742,7 @@ run_aggregation (void *cls)
cleanup_au (&au_active); cleanup_au (&au_active);
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
global_ret = GR_DATABASE_ITERATE_DEPOSIT_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -805,7 +791,7 @@ run_aggregation (void *cls)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n"); "Failed to start database transaction!\n");
global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL; global_ret = EXIT_FAILURE;
cleanup_au (&au_active); cleanup_au (&au_active);
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
@ -843,7 +829,7 @@ run_aggregation (void *cls)
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
cleanup_au (&au_active); cleanup_au (&au_active);
global_ret = GR_DATABASE_TINY_MARK_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -926,7 +912,7 @@ run_aggregation (void *cls)
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
/* die hard */ /* die hard */
global_ret = GR_DATABASE_PREPARE_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -948,7 +934,7 @@ run_aggregation (void *cls)
return; return;
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
global_ret = GR_DATABASE_PREPARE_COMMIT_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
@ -960,7 +946,7 @@ run_aggregation (void *cls)
return; return;
default: default:
GNUNET_break (0); GNUNET_break (0);
global_ret = GR_INVARIANT_FAILURE; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -989,7 +975,7 @@ run (void *cls,
if (GNUNET_OK != parse_wirewatch_config ()) if (GNUNET_OK != parse_wirewatch_config ())
{ {
cfg = NULL; cfg = NULL;
global_ret = GR_CONFIGURATION_INVALID; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
GNUNET_assert (NULL == task); GNUNET_assert (NULL == task);
@ -1025,7 +1011,7 @@ main (int argc,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv, GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv)) &argc, &argv))
return GR_CMD_LINE_UTF8_ERROR; return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run ( ret = GNUNET_PROGRAM_run (
argc, argv, argc, argv,
"taler-exchange-aggregator", "taler-exchange-aggregator",
@ -1035,9 +1021,9 @@ main (int argc,
&run, NULL); &run, NULL);
GNUNET_free_nz ((void *) argv); GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return GR_CMD_LINE_OPTIONS_WRONG; return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
return global_ret; return global_ret;
} }

View File

@ -66,22 +66,7 @@ static struct GNUNET_TIME_Relative aggregator_idle_sleep_interval;
* Value to return from main(). 0 on success, non-zero * Value to return from main(). 0 on success, non-zero
* on serious errors. * on serious errors.
*/ */
static enum static int global_ret;
{
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;
/** /**
* #GNUNET_YES if we are in test mode and should exit when idle. * #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, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No wire account configured to deal with target URI `%s'\n", "No wire account configured to deal with target URI `%s'\n",
account_payto_uri); account_payto_uri);
global_ret = GR_WIRE_ACCOUNT_NOT_CONFIGURED; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
@ -321,7 +306,7 @@ expired_reserve_cb (void *cls,
&currency_round_unit)) &currency_round_unit))
{ {
GNUNET_break (0); GNUNET_break (0);
global_ret = GR_FAILURE_TO_ROUND_AMOUNT; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
@ -360,7 +345,7 @@ expired_reserve_cb (void *cls,
(GNUNET_DB_STATUS_HARD_ERROR == qs) ) (GNUNET_DB_STATUS_HARD_ERROR == qs) )
{ {
GNUNET_break (0); GNUNET_break (0);
global_ret = GR_DATABASE_INSERT_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
@ -396,7 +381,7 @@ expired_reserve_cb (void *cls,
if (GNUNET_DB_STATUS_HARD_ERROR == qs) if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{ {
GNUNET_break (0); GNUNET_break (0);
global_ret = GR_DATABASE_INSERT_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
@ -429,7 +414,7 @@ run_reserve_closures (void *cls)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n"); "Failed to obtain database session!\n");
global_ret = GR_DATABASE_SESSION_START_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -441,7 +426,7 @@ run_reserve_closures (void *cls)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n"); "Failed to start database transaction!\n");
global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -463,7 +448,7 @@ run_reserve_closures (void *cls)
GNUNET_break (0); GNUNET_break (0);
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
global_ret = GR_DATABASE_SELECT_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
@ -524,7 +509,7 @@ run (void *cls,
if (GNUNET_OK != parse_wirewatch_config ()) if (GNUNET_OK != parse_wirewatch_config ())
{ {
cfg = NULL; cfg = NULL;
global_ret = GR_CONFIGURATION_INVALID; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
GNUNET_assert (NULL == task); GNUNET_assert (NULL == task);
@ -560,7 +545,7 @@ main (int argc,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv, GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv)) &argc, &argv))
return GR_CMD_LINE_UTF8_ERROR; return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run ( ret = GNUNET_PROGRAM_run (
argc, argv, argc, argv,
"taler-exchange-closer", "taler-exchange-closer",
@ -569,9 +554,9 @@ main (int argc,
&run, NULL); &run, NULL);
GNUNET_free_nz ((void *) argv); GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return GR_CMD_LINE_OPTIONS_WRONG; return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
return global_ret; return global_ret;
} }

View File

@ -1635,10 +1635,10 @@ main (int argc,
ret = GNUNET_GETOPT_run ("taler-exchange-httpd", ret = GNUNET_GETOPT_run ("taler-exchange-httpd",
options, options,
argc, argv); argc, argv);
if (ret < 0) if (GNUNET_SYSERR == ret)
return 1; return EXIT_INVALIDARGUMENT;
if (0 == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
if (0 == num_threads) if (0 == num_threads)
{ {
cpu_set_t mask; cpu_set_t mask;
@ -1669,12 +1669,12 @@ main (int argc,
"Malformed configuration file `%s', exit ...\n", "Malformed configuration file `%s', exit ...\n",
cfgfile); cfgfile);
GNUNET_free (cfgfile); GNUNET_free (cfgfile);
return 1; return EXIT_NOTCONFIGURED;
} }
GNUNET_free (cfgfile); GNUNET_free (cfgfile);
if (GNUNET_OK != if (GNUNET_OK !=
exchange_serve_process_config ()) exchange_serve_process_config ())
return 1; return EXIT_NOTCONFIGURED;
TEH_load_terms (TEH_cfg); TEH_load_terms (TEH_cfg);
/* check for systemd-style FD passing */ /* check for systemd-style FD passing */
@ -1715,10 +1715,10 @@ main (int argc,
/* initialize #internal_key_state with an RC of 1 */ /* initialize #internal_key_state with an RC of 1 */
if (GNUNET_OK != if (GNUNET_OK !=
TEH_WIRE_init ()) TEH_WIRE_init ())
return 42; return EXIT_FAILURE;
if (GNUNET_OK != if (GNUNET_OK !=
TEH_keys_init ()) TEH_keys_init ())
return 43; return EXIT_FAILURE;
ret = TEH_loop_init (); ret = TEH_loop_init ();
if (GNUNET_OK == ret) if (GNUNET_OK == ret)
{ {
@ -1737,7 +1737,7 @@ main (int argc,
fh = TALER_MHD_open_unix_path (serve_unixpath, fh = TALER_MHD_open_unix_path (serve_unixpath,
unixpath_mode); unixpath_mode);
if (-1 == fh) if (-1 == fh)
return 1; return EXIT_NOPERMISSION; /* at least most likely */
} }
ret = run_main_loop (fh, ret = run_main_loop (fh,
argv); argv);

View File

@ -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. * Value to return from main(). 0 on success, non-zero on errors.
*/ */
static enum static int global_ret;
{
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;
/** /**
* #GNUNET_YES if we are in test mode and should exit when idle. * #GNUNET_YES if we are in test mode and should exit when idle.
@ -290,7 +276,7 @@ wire_confirm_cb (void *cls,
ec); ec);
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
global_ret = GR_WIRE_TRANSFER_FAILED; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
GNUNET_free (wpd); GNUNET_free (wpd);
wpd = NULL; wpd = NULL;
@ -310,7 +296,7 @@ wire_confirm_cb (void *cls,
} }
else else
{ {
global_ret = GR_DATABASE_COMMIT_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
} }
GNUNET_free (wpd); GNUNET_free (wpd);
@ -329,7 +315,7 @@ wire_confirm_cb (void *cls,
return; return;
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
global_ret = GR_DATABASE_COMMIT_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
@ -343,7 +329,7 @@ wire_confirm_cb (void *cls,
return; return;
default: default:
GNUNET_break (0); GNUNET_break (0);
global_ret = GR_INVARIANT_FAILURE; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -376,7 +362,7 @@ wire_prepare_cb (void *cls,
GNUNET_break (0); GNUNET_break (0);
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
wpd->session); wpd->session);
global_ret = GR_DATABASE_FETCH_FAILURE; global_ret = EXIT_FAILURE;
goto cleanup; goto cleanup;
} }
wpd->row_id = rowid; wpd->row_id = rowid;
@ -391,7 +377,7 @@ wire_prepare_cb (void *cls,
GNUNET_break (0); GNUNET_break (0);
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
wpd->session); wpd->session);
global_ret = GR_WIRE_ACCOUNT_NOT_CONFIGURED; global_ret = EXIT_NOTCONFIGURED;
goto cleanup; goto cleanup;
} }
wa = wpd->wa; wa = wpd->wa;
@ -406,7 +392,7 @@ wire_prepare_cb (void *cls,
GNUNET_break (0); /* Irrecoverable */ GNUNET_break (0); /* Irrecoverable */
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
wpd->session); wpd->session);
global_ret = GR_WIRE_TRANSFER_BEGIN_FAIL; global_ret = EXIT_FAILURE;
goto cleanup; goto cleanup;
} }
return; return;
@ -437,7 +423,7 @@ run_transfers (void *cls)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n"); "Failed to obtain database session!\n");
global_ret = GR_DATABASE_SESSION_START_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -448,7 +434,7 @@ run_transfers (void *cls)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n"); "Failed to start database transaction!\n");
global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -468,7 +454,7 @@ run_transfers (void *cls)
{ {
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
global_ret = GR_DATABASE_COMMIT_HARD_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
@ -524,7 +510,7 @@ run (void *cls,
if (GNUNET_OK != parse_wirewatch_config ()) if (GNUNET_OK != parse_wirewatch_config ())
{ {
cfg = NULL; cfg = NULL;
global_ret = GR_CONFIGURATION_INVALID; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule, ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
@ -570,7 +556,7 @@ main (int argc,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv, GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv)) &argc, &argv))
return GR_CMD_LINE_UTF8_ERROR; return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run ( ret = GNUNET_PROGRAM_run (
argc, argv, argc, argv,
"taler-exchange-transfer", "taler-exchange-transfer",
@ -580,9 +566,9 @@ main (int argc,
&run, NULL); &run, NULL);
GNUNET_free_nz ((void *) argv); GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return GR_CMD_LINE_OPTIONS_WRONG; return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
return global_ret; return global_ret;
} }

View File

@ -198,17 +198,7 @@ static unsigned int max_workers = 16;
* Value to return from main(). 0 on success, non-zero on * Value to return from main(). 0 on success, non-zero on
* on serious errors. * on serious errors.
*/ */
static enum static int global_ret;
{
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;
/** /**
* Are we run in testing mode and should only do one pass? * 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, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n"); "Failed to obtain database session!\n");
global_ret = GR_DATABASE_SESSION_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -650,7 +640,7 @@ find_transfers (void *cls)
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain starting point for montoring from database!\n"); "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 (); GNUNET_SCHEDULER_shutdown ();
return; return;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
@ -683,7 +673,7 @@ find_transfers (void *cls)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n"); "Failed to start database transaction!\n");
global_ret = GR_DATABASE_TRANSACTION_BEGIN_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -704,7 +694,7 @@ find_transfers (void *cls)
"Failed to start request for account history!\n"); "Failed to start request for account history!\n");
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
global_ret = GR_BANK_REQUEST_HISTORY_FAIL; global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -733,7 +723,7 @@ run (void *cls,
if (GNUNET_OK != if (GNUNET_OK !=
exchange_serve_process_config ()) exchange_serve_process_config ())
{ {
global_ret = GR_CONFIGURATION_INVALID; global_ret = EXIT_NOTCONFIGURED;
return; return;
} }
wa_pos = wa_head; wa_pos = wa_head;
@ -789,7 +779,7 @@ main (int argc,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv, GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv)) &argc, &argv))
return GR_CMD_LINE_UTF8_ERROR; return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run ( ret = GNUNET_PROGRAM_run (
argc, argv, argc, argv,
"taler-exchange-wirewatch", "taler-exchange-wirewatch",
@ -799,9 +789,9 @@ main (int argc,
&run, NULL); &run, NULL);
GNUNET_free_nz ((void *) argv); GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return GR_CMD_LINE_OPTIONS_WRONG; return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret) if (GNUNET_NO == ret)
return 0; return EXIT_SUCCESS;
return global_ret; return global_ret;
} }

View File

@ -66,6 +66,33 @@
is needed for performance reasons. */ is needed for performance reasons. */
#define ENABLE_SANITY_CHECKS 1 #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_ */ #endif /* PLATFORM_H_ */
/* end of platform.h */ /* end of platform.h */

View File

@ -17,10 +17,10 @@ libtalerjson_la_SOURCES = \
json_wire.c json_wire.c
libtalerjson_la_LDFLAGS = \ libtalerjson_la_LDFLAGS = \
-version-info 1:0:1 \ -version-info 1:0:1 \
-export-dynamic -no-undefined -no-undefined
libtalerjson_la_LIBADD = \ libtalerjson_la_LIBADD = \
-lgnunetjson \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
-lgnunetjson \
-lgnunetutil \ -lgnunetutil \
-ljansson \ -ljansson \
-lm \ -lm \

View File

@ -16,7 +16,7 @@ libtalermhd_la_SOURCES = \
mhd_responses.c mhd_responses.c
libtalermhd_la_LDFLAGS = \ libtalermhd_la_LDFLAGS = \
-version-info 0:0:0 \ -version-info 0:0:0 \
-export-dynamic -no-undefined -no-undefined
libtalermhd_la_LIBADD = \ libtalermhd_la_LIBADD = \
-lgnunetjson \ -lgnunetjson \
$(top_builddir)/src/json/libtalerjson.la \ $(top_builddir)/src/json/libtalerjson.la \

View File

@ -20,7 +20,7 @@ libtalerpq_la_LIBADD = \
libtalerpq_la_LDFLAGS = \ libtalerpq_la_LDFLAGS = \
$(POSTGRESQL_LDFLAGS) \ $(POSTGRESQL_LDFLAGS) \
-version-info 0:0:0 \ -version-info 0:0:0 \
-export-dynamic -no-undefined -no-undefined
check_PROGRAMS= \ check_PROGRAMS= \
test_pq test_pq

View File

@ -20,7 +20,7 @@ libtalersq_la_LIBADD = \
libtalersq_la_LDFLAGS = \ libtalersq_la_LDFLAGS = \
$(SQLITE_LDFLAGS) \ $(SQLITE_LDFLAGS) \
-version-info 0:0:0 \ -version-info 0:0:0 \
-export-dynamic -no-undefined -no-undefined
check_PROGRAMS= \ check_PROGRAMS= \
test_sq test_sq

View File

@ -89,7 +89,7 @@ libtalerutil_la_LIBADD = \
libtalerutil_la_LDFLAGS = \ libtalerutil_la_LDFLAGS = \
-version-info 0:0:0 \ -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; AM_TESTS_ENVIRONMENT=export TALER_PREFIX=$${TALER_PREFIX:-@libdir@};export PATH=$${TALER_PREFIX:-@prefix@}/bin:$$PATH;