summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-01 17:51:46 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-01 17:51:46 +0100
commit113f3891d13a15b87827a8b1b33508231a1409b7 (patch)
tree8b665c481282b0d3778deee534fd2b36b992608c
parentc11475c081afcd5ccc667451b9383510fd42cf1b (diff)
downloadexchange-113f3891d13a15b87827a8b1b33508231a1409b7.tar.gz
exchange-113f3891d13a15b87827a8b1b33508231a1409b7.tar.bz2
exchange-113f3891d13a15b87827a8b1b33508231a1409b7.zip
removing dead code, using more named constants, checking return values better
-rw-r--r--src/auditor/taler-auditor-httpd.c2
-rw-r--r--src/auditor/taler-auditor.c18
-rw-r--r--src/exchange/taler-exchange-aggregator.c8
-rw-r--r--src/exchange/taler-exchange-httpd.c2
-rw-r--r--src/exchange/taler-exchange-httpd_keystate.c2
-rw-r--r--src/exchange/taler-exchange-httpd_transfers_get.c2
-rw-r--r--src/mhd/mhd_legal.c14
-rw-r--r--src/pq/pq_query_helper.c4
-rw-r--r--src/testing/testing_api_helpers_bank.c1
9 files changed, 25 insertions, 28 deletions
diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c
index 043d5b14..ff069f2a 100644
--- a/src/auditor/taler-auditor-httpd.c
+++ b/src/auditor/taler-auditor-httpd.c
@@ -232,7 +232,7 @@ signal_loop (void)
}
if (EINTR == errno)
{
- ret = 2;
+ /* ignore, do the loop again */
continue;
}
switch (c)
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c
index d211bd94..2d33987b 100644
--- a/src/auditor/taler-auditor.c
+++ b/src/auditor/taler-auditor.c
@@ -772,7 +772,7 @@ get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
NULL);
if (qs <= 0)
{
- if (0 == qs)
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Denomination %s not found\n",
TALER_B2S (dh));
@@ -3774,10 +3774,10 @@ refresh_session_cb (void *cls,
cc->qs = qs;
return GNUNET_SYSERR;
}
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- check_known_coin (coin_pub,
- denom_pub,
- amount_with_fee))
+ qs = check_known_coin (coin_pub,
+ denom_pub,
+ amount_with_fee);
+ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
cc->qs = qs;
@@ -4152,10 +4152,10 @@ deposit_cb (void *cls,
cc->qs = qs;
return GNUNET_SYSERR;
}
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- check_known_coin (coin_pub,
- denom_pub,
- amount_with_fee))
+ qs = check_known_coin (coin_pub,
+ denom_pub,
+ amount_with_fee);
+ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
cc->qs = qs;
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index 1a8889fd..bf066d84 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -405,6 +405,7 @@ update_fees (struct WireAccount *wa,
&p->master_sig);
if (qs < 0)
{
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
TALER_EXCHANGEDB_fees_free (wa->af);
wa->af = NULL;
return NULL;
@@ -854,10 +855,9 @@ deposit_cb (void *cls,
au->session);
if (NULL == af)
{
- if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
- qs = GNUNET_DB_STATUS_HARD_ERROR;
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not get or persist wire fees. Aborting run.\n");
+ return GNUNET_DB_STATUS_HARD_ERROR;
}
au->wire_fee = af->wire_fee;
}
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index 153bb19f..0061ac86 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -615,6 +615,8 @@ handle_mhd_request (void *cls,
/* strange, should start with '/', treat as just "/" */
url = "/";
start = strchr (url + 1, '/');
+ if (NULL == start)
+ start = "";
ret = proceed_with_handler (ecls->rh,
connection,
start,
diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c
index add201aa..9be78e5e 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -2338,7 +2338,7 @@ TEH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
/* This *can* happen if the exchange's keys are
not properly maintained. */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("Cannot sign request, no valid keys available\n"));
+ "Cannot sign request, no valid keys available\n");
return GNUNET_SYSERR;
}
*pub = key_state->current_sign_key_issue.issue.signkey_pub;
diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c
index 713b43a5..e7fceb49 100644
--- a/src/exchange/taler-exchange-httpd_transfers_get.c
+++ b/src/exchange/taler-exchange-httpd_transfers_get.c
@@ -434,7 +434,7 @@ track_transfer_transaction (void *cls,
if (0 >= qs)
{
if ( (GNUNET_DB_STATUS_HARD_ERROR == qs) ||
- (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS) )
+ (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) )
{
GNUNET_break (0);
*mhd_ret = TALER_MHD_reply_with_error (connection,
diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c
index f99289a2..051c87e9 100644
--- a/src/mhd/mhd_legal.c
+++ b/src/mhd/mhd_legal.c
@@ -403,7 +403,7 @@ load_terms (struct TALER_MHD_Legal *legal,
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"fstat",
fn);
- (void) close (fd);
+ GNUENT_break (0 == close (fd));
GNUNET_free (fn);
return;
}
@@ -412,7 +412,7 @@ load_terms (struct TALER_MHD_Legal *legal,
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"fstat-size",
fn);
- (void) close (fd);
+ GNUNET_break (0 == close (fd));
GNUNET_free (fn);
return;
}
@@ -427,7 +427,7 @@ load_terms (struct TALER_MHD_Legal *legal,
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
"malloc");
- (void) close (fd);
+ GNUNET_break (0 == close (fd));
GNUNET_free (fn);
return;
}
@@ -440,12 +440,12 @@ load_terms (struct TALER_MHD_Legal *legal,
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"read",
fn);
- (void) close (fd);
+ GNUNET_break (0 == close (fd));
GNUNET_free (buf);
GNUNET_free (fn);
return;
}
- (void) close (fd);
+ GNUNET_break (0 == close (fd));
GNUNET_free (fn);
/* append to global list of terms of service */
@@ -501,7 +501,7 @@ load_language (struct TALER_MHD_Legal *legal,
continue;
load_terms (legal, path, lang, fn);
}
- closedir (d);
+ GNUNET_break (0 == closedir (d));
GNUNET_free (dname);
}
@@ -577,7 +577,7 @@ TALER_MHD_legal_load (const struct GNUNET_CONFIGURATION_Handle *cfg,
continue;
load_language (legal, path, lang);
}
- closedir (d);
+ GNUNET_break (0 == closedir (d));
GNUNET_free (path);
return legal;
}
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index 3eef3007..f558cbcc 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -248,8 +248,6 @@ qconv_round_time (void *cls,
GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
GNUNET_assert (scratch_length > 0);
GNUNET_break (NULL == cls);
- if (1 != param_length)
- return -1;
tmp = *at;
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
@@ -316,8 +314,6 @@ qconv_round_time_abs (void *cls,
GNUNET_assert (1 == param_length);
GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
GNUNET_break (NULL == cls);
- if (1 != param_length)
- return -1;
tmp = GNUNET_TIME_absolute_ntoh (*at);
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
diff --git a/src/testing/testing_api_helpers_bank.c b/src/testing/testing_api_helpers_bank.c
index 35ef4792..3cfb693a 100644
--- a/src/testing/testing_api_helpers_bank.c
+++ b/src/testing/testing_api_helpers_bank.c
@@ -430,7 +430,6 @@ TALER_TESTING_prepare_fakebank (const char *config_filename,
GNUNET_CONFIGURATION_destroy (cfg);
return GNUNET_SYSERR;
}
- bc->exchange_auth.method = TALER_BANK_AUTH_NONE;
{
char *exchange_xtalerbank_account;