nfc_init() return rather than exit on malloc error, examples fixed accordingly
This commit is contained in:
parent
ae6062e5ba
commit
73b5c9d0af
22 changed files with 92 additions and 9 deletions
|
|
@ -380,6 +380,10 @@ main(int argc, char *argv[])
|
|||
|
||||
nfc_context *context;
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
ERR("Unable to init libnfc (malloc)\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Try to open the NFC reader
|
||||
pnd = nfc_open(context, NULL);
|
||||
|
|
|
|||
|
|
@ -71,6 +71,10 @@ main(int argc, const char *argv[])
|
|||
|
||||
nfc_context *context;
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
ERR("Unable to init libnfc (malloc)");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Display libnfc version
|
||||
acLibnfcVersion = nfc_version();
|
||||
|
|
|
|||
|
|
@ -503,11 +503,15 @@ main(int argc, const char *argv[])
|
|||
// printf("Successfully opened required files\n");
|
||||
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
ERR("Unable to init libnfc (malloc)");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Try to open the NFC reader
|
||||
pnd = nfc_open(context, NULL);
|
||||
if (pnd == NULL) {
|
||||
printf("Error opening NFC reader\n");
|
||||
ERR("Error opening NFC reader");
|
||||
nfc_exit(context);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,11 +206,15 @@ main(int argc, const char *argv[])
|
|||
|
||||
nfc_context *context;
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
ERR("Unable to init libnfc (malloc)");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Try to open the NFC device
|
||||
pnd = nfc_open(context, NULL);
|
||||
if (pnd == NULL) {
|
||||
ERR("Error opening NFC device\n");
|
||||
ERR("Error opening NFC device");
|
||||
nfc_exit(context);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,6 +198,10 @@ main(int argc, char *argv[])
|
|||
|
||||
nfc_context *context;
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
ERR("Unable to init libnfc (malloc)\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
pnd = nfc_open(context, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -197,6 +197,10 @@ main(int argc, char *argv[])
|
|||
|
||||
nfc_context *context;
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
ERR("Unable to init libnfc (malloc)");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
// List available devices
|
||||
|
|
|
|||
|
|
@ -90,6 +90,10 @@ main(int argc, const char *argv[])
|
|||
}
|
||||
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
ERR("Unable to init libnfc (malloc)\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Display libnfc version
|
||||
acLibnfcVersion = nfc_version();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue