From 4822bb3e4202cfc6824d91a1cacffc06ecff0bfe Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 5 Mar 2013 23:58:35 +0100 Subject: [PATCH] Fix bug introduced in some signal traps where context was not declared --- examples/nfc-dep-initiator.c | 2 +- examples/nfc-dep-target.c | 2 +- examples/nfc-emulate-forum-tag2.c | 2 +- examples/nfc-emulate-uid.c | 2 +- examples/nfc-poll.c | 2 +- utils/nfc-emulate-forum-tag4.c | 2 +- utils/nfc-read-forum-tag3.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/nfc-dep-initiator.c b/examples/nfc-dep-initiator.c index c34ea6c..c095a4b 100644 --- a/examples/nfc-dep-initiator.c +++ b/examples/nfc-dep-initiator.c @@ -49,6 +49,7 @@ #define MAX_FRAME_LEN 264 static nfc_device *pnd; +static nfc_context *context; static void stop_dep_communication(int sig) { @@ -73,7 +74,6 @@ main(int argc, const char *argv[]) exit(EXIT_FAILURE); } - nfc_context *context; nfc_init(&context); if (context == NULL) { ERR("Unable to init libnfc (malloc)"); diff --git a/examples/nfc-dep-target.c b/examples/nfc-dep-target.c index b91ec18..1aef22d 100644 --- a/examples/nfc-dep-target.c +++ b/examples/nfc-dep-target.c @@ -48,6 +48,7 @@ #define MAX_FRAME_LEN 264 static nfc_device *pnd; +static nfc_context *context; static void stop_dep_communication(int sig) { @@ -72,7 +73,6 @@ main(int argc, const char *argv[]) exit(EXIT_FAILURE); } - nfc_context *context; nfc_init(&context); if (context == NULL) { ERR("Unable to init libnfc (malloc)"); diff --git a/examples/nfc-emulate-forum-tag2.c b/examples/nfc-emulate-forum-tag2.c index cdd430e..e008379 100644 --- a/examples/nfc-emulate-forum-tag2.c +++ b/examples/nfc-emulate-forum-tag2.c @@ -74,6 +74,7 @@ #include "utils/nfc-utils.h" static nfc_device *pnd; +static nfc_context *context; static void stop_emulation(int sig) @@ -186,7 +187,6 @@ main(int argc, char *argv[]) signal(SIGINT, stop_emulation); - nfc_context *context; nfc_init(&context); if (context == NULL) { ERR("Unable to init libnfc (malloc)"); diff --git a/examples/nfc-emulate-uid.c b/examples/nfc-emulate-uid.c index 969848f..408ee3a 100644 --- a/examples/nfc-emulate-uid.c +++ b/examples/nfc-emulate-uid.c @@ -59,6 +59,7 @@ static uint8_t abtRecv[MAX_FRAME_LEN]; static int szRecvBits; static nfc_device *pnd; +static nfc_context *context; // ISO14443A Anti-Collision response uint8_t abtAtqa[2] = { 0x04, 0x00 }; @@ -126,7 +127,6 @@ main(int argc, char *argv[]) signal(SIGINT, intr_hdlr); #endif - nfc_context *context; nfc_init(&context); if (context == NULL) { ERR("Unable to init libnfc (malloc)"); diff --git a/examples/nfc-poll.c b/examples/nfc-poll.c index 0f885bb..b5f29ee 100644 --- a/examples/nfc-poll.c +++ b/examples/nfc-poll.c @@ -52,6 +52,7 @@ #define MAX_DEVICE_COUNT 16 static nfc_device *pnd = NULL; +static nfc_context *context; static void stop_polling(int sig) { @@ -105,7 +106,6 @@ main(int argc, const char *argv[]) nfc_target nt; int res = 0; - nfc_context *context; nfc_init(&context); if (context == NULL) { ERR("Unable to init libnfc (malloc)"); diff --git a/utils/nfc-emulate-forum-tag4.c b/utils/nfc-emulate-forum-tag4.c index f604388..47335ba 100644 --- a/utils/nfc-emulate-forum-tag4.c +++ b/utils/nfc-emulate-forum-tag4.c @@ -71,6 +71,7 @@ #include "nfc-utils.h" static nfc_device *pnd; +static nfc_context *context; static bool quiet_output = false; // Version of the emulated type4 tag: static int type4v = 2; @@ -380,7 +381,6 @@ main(int argc, char *argv[]) } } - nfc_context *context; nfc_init(&context); if (context == NULL) { ERR("Unable to init libnfc (malloc)\n"); diff --git a/utils/nfc-read-forum-tag3.c b/utils/nfc-read-forum-tag3.c index 720ff6a..df4a543 100644 --- a/utils/nfc-read-forum-tag3.c +++ b/utils/nfc-read-forum-tag3.c @@ -60,6 +60,7 @@ #endif static nfc_device *pnd; +static nfc_context *context; static void print_usage(char *progname) @@ -198,7 +199,6 @@ main(int argc, char *argv[]) } } - nfc_context *context; nfc_init(&context); if (context == NULL) { ERR("Unable to init libnfc (malloc)\n");