From e5d685a23dd437228d138babc7249c98f2afe1e9 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Fri, 20 Nov 2009 15:54:04 +0000 Subject: [PATCH] nfc-relay: exit properly if emulator initialization failed. --- src/examples/nfc-relay.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/examples/nfc-relay.c b/src/examples/nfc-relay.c index 1a986f0..5984387 100644 --- a/src/examples/nfc-relay.c +++ b/src/examples/nfc-relay.c @@ -81,7 +81,12 @@ int main(int argc,char* argv[]) printf("[+] Try to break out the auto-emulation, this requires a second reader!\n"); printf("[+] To do this, please send any command after the anti-collision\n"); printf("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n"); - nfc_target_init(pdiTag,abtReaderRx,&szReaderRxBits); + if (!nfc_target_init(pdiTag,abtReaderRx,&szReaderRxBits)) + { + printf("[+] Initialization of NFC emulator failed\n"); + nfc_disconnect(pdiTag); + return 1; + } printf("[+] Configuring emulator settings\n"); nfc_configure(pdiTag,DCO_HANDLE_CRC,false); nfc_configure(pdiTag,DCO_HANDLE_PARITY,false);