summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-transfer.c
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 /src/exchange/taler-exchange-transfer.c
parent1b419adab48fc0fd915835e0d57c5923e515280c (diff)
downloadexchange-0ef7c0a0b716785e7d1b0233e622d2e7267a0280.tar.gz
exchange-0ef7c0a0b716785e7d1b0233e622d2e7267a0280.tar.bz2
exchange-0ef7c0a0b716785e7d1b0233e622d2e7267a0280.zip
fix #6960
Diffstat (limited to 'src/exchange/taler-exchange-transfer.c')
-rw-r--r--src/exchange/taler-exchange-transfer.c44
1 files changed, 15 insertions, 29 deletions
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;
}