error handling

This commit is contained in:
Unknown 2020-06-30 17:19:24 +02:00
parent f2677da74c
commit 6fb61d3c1e

View file

@ -822,9 +822,17 @@ main(int argc, const char *argv[])
} }
printf("Done.\n"); printf("Done.\n");
fclose(pfDump); fclose(pfDump);
} else {
nfc_close(pnd);
nfc_exit(context);
exit(EXIT_FAILURE);
} }
} else if (atAction == ACTION_WRITE) { } else if (atAction == ACTION_WRITE) {
write_card(unlock); if (!write_card(unlock)) {
nfc_close(pnd);
nfc_exit(context);
exit(EXIT_FAILURE);
}
} }
nfc_close(pnd); nfc_close(pnd);