Fix bug introduced in some signal traps where context was not declared

This commit is contained in:
Philippe Teuwen 2013-03-05 23:58:35 +01:00
parent 03bc30f116
commit 4822bb3e42
7 changed files with 7 additions and 7 deletions

View file

@ -49,6 +49,7 @@
#define MAX_FRAME_LEN 264 #define MAX_FRAME_LEN 264
static nfc_device *pnd; static nfc_device *pnd;
static nfc_context *context;
static void stop_dep_communication(int sig) static void stop_dep_communication(int sig)
{ {
@ -73,7 +74,6 @@ main(int argc, const char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
nfc_context *context;
nfc_init(&context); nfc_init(&context);
if (context == NULL) { if (context == NULL) {
ERR("Unable to init libnfc (malloc)"); ERR("Unable to init libnfc (malloc)");

View file

@ -48,6 +48,7 @@
#define MAX_FRAME_LEN 264 #define MAX_FRAME_LEN 264
static nfc_device *pnd; static nfc_device *pnd;
static nfc_context *context;
static void stop_dep_communication(int sig) static void stop_dep_communication(int sig)
{ {
@ -72,7 +73,6 @@ main(int argc, const char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
nfc_context *context;
nfc_init(&context); nfc_init(&context);
if (context == NULL) { if (context == NULL) {
ERR("Unable to init libnfc (malloc)"); ERR("Unable to init libnfc (malloc)");

View file

@ -74,6 +74,7 @@
#include "utils/nfc-utils.h" #include "utils/nfc-utils.h"
static nfc_device *pnd; static nfc_device *pnd;
static nfc_context *context;
static void static void
stop_emulation(int sig) stop_emulation(int sig)
@ -186,7 +187,6 @@ main(int argc, char *argv[])
signal(SIGINT, stop_emulation); signal(SIGINT, stop_emulation);
nfc_context *context;
nfc_init(&context); nfc_init(&context);
if (context == NULL) { if (context == NULL) {
ERR("Unable to init libnfc (malloc)"); ERR("Unable to init libnfc (malloc)");

View file

@ -59,6 +59,7 @@
static uint8_t abtRecv[MAX_FRAME_LEN]; static uint8_t abtRecv[MAX_FRAME_LEN];
static int szRecvBits; static int szRecvBits;
static nfc_device *pnd; static nfc_device *pnd;
static nfc_context *context;
// ISO14443A Anti-Collision response // ISO14443A Anti-Collision response
uint8_t abtAtqa[2] = { 0x04, 0x00 }; uint8_t abtAtqa[2] = { 0x04, 0x00 };
@ -126,7 +127,6 @@ main(int argc, char *argv[])
signal(SIGINT, intr_hdlr); signal(SIGINT, intr_hdlr);
#endif #endif
nfc_context *context;
nfc_init(&context); nfc_init(&context);
if (context == NULL) { if (context == NULL) {
ERR("Unable to init libnfc (malloc)"); ERR("Unable to init libnfc (malloc)");

View file

@ -52,6 +52,7 @@
#define MAX_DEVICE_COUNT 16 #define MAX_DEVICE_COUNT 16
static nfc_device *pnd = NULL; static nfc_device *pnd = NULL;
static nfc_context *context;
static void stop_polling(int sig) static void stop_polling(int sig)
{ {
@ -105,7 +106,6 @@ main(int argc, const char *argv[])
nfc_target nt; nfc_target nt;
int res = 0; int res = 0;
nfc_context *context;
nfc_init(&context); nfc_init(&context);
if (context == NULL) { if (context == NULL) {
ERR("Unable to init libnfc (malloc)"); ERR("Unable to init libnfc (malloc)");

View file

@ -71,6 +71,7 @@
#include "nfc-utils.h" #include "nfc-utils.h"
static nfc_device *pnd; static nfc_device *pnd;
static nfc_context *context;
static bool quiet_output = false; static bool quiet_output = false;
// Version of the emulated type4 tag: // Version of the emulated type4 tag:
static int type4v = 2; static int type4v = 2;
@ -380,7 +381,6 @@ main(int argc, char *argv[])
} }
} }
nfc_context *context;
nfc_init(&context); nfc_init(&context);
if (context == NULL) { if (context == NULL) {
ERR("Unable to init libnfc (malloc)\n"); ERR("Unable to init libnfc (malloc)\n");

View file

@ -60,6 +60,7 @@
#endif #endif
static nfc_device *pnd; static nfc_device *pnd;
static nfc_context *context;
static void static void
print_usage(char *progname) print_usage(char *progname)
@ -198,7 +199,6 @@ main(int argc, char *argv[])
} }
} }
nfc_context *context;
nfc_init(&context); nfc_init(&context);
if (context == NULL) { if (context == NULL) {
ERR("Unable to init libnfc (malloc)\n"); ERR("Unable to init libnfc (malloc)\n");