]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
dpp-nfc: Return failure status if operation fails
authorJouni Malinen <jouni@codeaurora.org>
Thu, 23 Jul 2020 09:26:46 +0000 (12:26 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 23 Jul 2020 09:26:46 +0000 (12:26 +0300)
For now, this is done only for the case where the NFC Device is not
usable and if writing a single tag fails.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/examples/dpp-nfc.py

index c0f67f7d4b9e94720da5c66b992c8d8548b8bd4f..bd03308597fbc222e37f70efbddb191aec986454 100755 (executable)
@@ -39,6 +39,7 @@ my_crn = None
 peer_crn = None
 hs_sent = False
 netrole = None
+operation_success = False
 mutex = threading.Lock()
 
 C_NORMAL = '\033[0m'
@@ -613,7 +614,8 @@ def rdwr_connected_write_tag(tag):
         return
     success_report("Tag write succeeded")
     summary("Tag writing completed - remove tag", color=C_GREEN)
-    global only_one
+    global only_one, operation_success
+    operation_success = True
     if only_one:
         global continue_loop
         continue_loop = False
@@ -858,14 +860,18 @@ def main():
     try:
         if not clf.open(args.device):
             summary("Could not open connection with an NFC device", color=C_RED)
-            raise SystemExit
+            raise SystemExit(1)
 
         if args.command == "write-nfc-uri":
             write_nfc_uri(clf, wait_remove=not args.no_wait)
+            if not operation_success:
+                raise SystemExit(1)
             raise SystemExit
 
         if args.command == "write-nfc-hs":
             write_nfc_hs(clf, wait_remove=not args.no_wait)
+            if not operation_success:
+                raise SystemExit(1)
             raise SystemExit
 
         global continue_loop