aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2019-12-16 15:09:26 +0100
committerlaforge <laforge@osmocom.org>2019-12-17 12:46:21 +0000
commite9556efe88aa6b64f4b83aec4fe89c867620b16d (patch)
treee32578377f9eae1c56b0dc17255cb77297464f8e
parentcdc08537779bef5e082d132e5d3e43df40b47eb7 (diff)
[lib] apdu_dispatch: Use DLGLOBAL and don't printf() directly
-rw-r--r--host/lib/apdu_dispatch.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/host/lib/apdu_dispatch.c b/host/lib/apdu_dispatch.c
index 62a75aa..835b8bc 100644
--- a/host/lib/apdu_dispatch.c
+++ b/host/lib/apdu_dispatch.c
@@ -1,6 +1,6 @@
/* apdu_dispatch - State machine to determine Rx/Tx phases of APDU
*
- * (C) 2016 by Harald Welte <hwelte@hmw-consulting.de>
+ * (C) 2016-2019 by Harald Welte <hwelte@hmw-consulting.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -24,6 +24,7 @@
#include <errno.h>
#include <osmocom/core/utils.h>
+#include <osmocom/core/logging.h>
#include <osmocom/sim/sim.h>
#include <osmocom/sim/class_tables.h>
@@ -105,7 +106,7 @@ int osmo_apdu_segment_in(struct osmo_apdu_context *ac, const uint8_t *apdu_buf,
break;
case 0:
default:
- fprintf(stderr, "Unknown APDU case %d\n", ac->apdu_case);
+ LOGP(DLGLOBAL, LOGL_ERROR, "Unknown APDU case %d\n", ac->apdu_case);
return -1;
}
} else {
@@ -124,8 +125,8 @@ int osmo_apdu_segment_in(struct osmo_apdu_context *ac, const uint8_t *apdu_buf,
ac->lc.cur += cpy_len;
break;
default:
- fprintf(stderr, "Unknown APDU case %d\n", ac->apdu_case);
- break;
+ LOGP(DLGLOBAL, LOGL_ERROR, "Unknown APDU case %d\n", ac->apdu_case);
+ return -1;
}
}
@@ -163,8 +164,8 @@ int osmo_apdu_segment_in(struct osmo_apdu_context *ac, const uint8_t *apdu_buf,
break;
case 0:
default:
- fprintf(stderr, "Unknown APDU case %d\n", ac->apdu_case);
- break;
+ LOGP(DLGLOBAL, LOGL_ERROR, "Unknown APDU case %d\n", ac->apdu_case);
+ return -1;
}
dump_apdu_ctx(ac);