diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-06-03 10:11:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-06-03 10:11:28 +0200 |
commit | 2cea0eb4d2ee117a48703370a4ff4be6b275df0f (patch) | |
tree | 66c0430e16febc7b25776300e72f34eae6a1ab22 /src/lib | |
parent | 69c1ca4d2363a921fc16b7579dce86e0cb29d3b1 (diff) |
add missing 'static', ensure no NPE, fail nicely even on bad test input
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/testing_api_cmd_track.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/lib/testing_api_cmd_track.c b/src/lib/testing_api_cmd_track.c index 6afb0ac65..4a054144d 100644 --- a/src/lib/testing_api_cmd_track.c +++ b/src/lib/testing_api_cmd_track.c @@ -243,6 +243,7 @@ deposit_wtid_cb TALER_TESTING_interpreter_next (tts->is); } + /** * Run the command. * @@ -340,6 +341,7 @@ track_transaction_run (void *cls, GNUNET_assert (NULL != tts->tth); } + /** * Cleanup the state from a "track transaction" CMD, and possibly * cancel a operation thereof. @@ -347,7 +349,7 @@ track_transaction_run (void *cls, * @param cls closure. * @param cmd the command which is being cleaned up. */ -void +static void track_transaction_cleanup (void *cls, const struct TALER_TESTING_Command *cmd) @@ -437,6 +439,7 @@ TALER_TESTING_cmd_track_transaction return cmd; } + /** * Cleanup the state for a "track transfer" CMD, and possibly * cancel a pending operation thereof. @@ -444,7 +447,7 @@ TALER_TESTING_cmd_track_transaction * @param cls closure. * @param cmd the command which is being cleaned up. */ -void +static void track_transfer_cleanup (void *cls, const struct TALER_TESTING_Command *cmd) { @@ -461,9 +464,9 @@ track_transfer_cleanup (void *cls, tts->tth = NULL; } GNUNET_free (tts); - } + /** * Check whether the HTTP response code from a "track transfer" * operation is acceptable, and all other values like total amount, @@ -505,11 +508,9 @@ track_transfer_cb struct TrackTransferState *tts = cls; struct TALER_TESTING_Interpreter *is = tts->is; struct TALER_TESTING_Command *cmd = &is->commands[is->ip]; - struct TALER_Amount expected_amount; tts->tth = NULL; - if (tts->expected_response_code != http_status) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -522,13 +523,18 @@ track_transfer_cb TALER_TESTING_interpreter_fail (is); return; } - - if ( (NULL == tts->expected_total_amount) || - (NULL == tts->expected_wire_fee) ) - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Expected amount and fee not specified, " - "likely to segfault...\n"); - + if (NULL == tts->expected_total_amount) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } + if (NULL == tts->expected_wire_fee) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } switch (http_status) { case MHD_HTTP_OK: |