mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-02-19 08:16:35 +00:00
examples/utils: add nfc_exit() to signal traps
and one missing nfc_abort_command()
This commit is contained in:
@@ -53,10 +53,12 @@ static nfc_device *pnd;
|
||||
static void stop_dep_communication(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
if (pnd != NULL)
|
||||
if (pnd != NULL) {
|
||||
nfc_abort_command(pnd);
|
||||
else
|
||||
} else {
|
||||
nfc_exit(context);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -52,10 +52,12 @@ static nfc_device *pnd;
|
||||
static void stop_dep_communication(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
if (pnd != NULL)
|
||||
if (pnd != NULL) {
|
||||
nfc_abort_command(pnd);
|
||||
else
|
||||
} else {
|
||||
nfc_exit(context);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -82,6 +82,7 @@ stop_emulation(int sig)
|
||||
if (pnd != NULL) {
|
||||
nfc_abort_command(pnd);
|
||||
} else {
|
||||
nfc_exit(context);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,9 @@ intr_hdlr(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
printf("\nQuitting...\n");
|
||||
if (pnd != NULL) {
|
||||
nfc_abort_command(pnd);
|
||||
}
|
||||
nfc_close(pnd);
|
||||
nfc_exit(context);
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
@@ -58,8 +58,10 @@ static void stop_polling(int sig)
|
||||
(void) sig;
|
||||
if (pnd != NULL)
|
||||
nfc_abort_command(pnd);
|
||||
else
|
||||
else {
|
||||
nfc_exit(context);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user