From e9556efe88aa6b64f4b83aec4fe89c867620b16d Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 16 Dec 2019 15:09:26 +0100 Subject: [PATCH] [lib] apdu_dispatch: Use DLGLOBAL and don't printf() directly Change-Id: I2f3ec49d34b6806e13af185fb629cabc486891fb --- host/lib/apdu_dispatch.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/host/lib/apdu_dispatch.c b/host/lib/apdu_dispatch.c index 62a75aa9..835b8bc1 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 + * (C) 2016-2019 by Harald Welte * * 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 #include +#include #include #include @@ -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);