Added check at end of function main for Error_Detected and return 1 if there were errors.
Added "Error_Detected=true" to TSM Timeout and ADPU Timeout error conditions.
This commit is contained in:
@@ -350,7 +350,8 @@ int main(int argc, char *argv[]) {
|
|||||||
else if (tsm_invoke_id_failed(invoke_id)) {
|
else if (tsm_invoke_id_failed(invoke_id)) {
|
||||||
fprintf(stderr, "\rError: TSM Timeout!\r\n");
|
fprintf(stderr, "\rError: TSM Timeout!\r\n");
|
||||||
tsm_free_invoke_id(invoke_id);
|
tsm_free_invoke_id(invoke_id);
|
||||||
/* try again or abort? */
|
Error_Detected = true;
|
||||||
|
/* try again or abort? */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -358,12 +359,14 @@ int main(int argc, char *argv[]) {
|
|||||||
elapsed_seconds += (current_seconds - last_seconds);
|
elapsed_seconds += (current_seconds - last_seconds);
|
||||||
if (elapsed_seconds > timeout_seconds) {
|
if (elapsed_seconds > timeout_seconds) {
|
||||||
printf("\rError: APDU Timeout!\r\n");
|
printf("\rError: APDU Timeout!\r\n");
|
||||||
break;
|
Error_Detected = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* keep track of time for next check */
|
/* keep track of time for next check */
|
||||||
last_seconds = current_seconds;
|
last_seconds = current_seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Error_Detected) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -436,13 +436,15 @@ int main(int argc, char *argv[]) {
|
|||||||
else if (tsm_invoke_id_failed(invoke_id)) {
|
else if (tsm_invoke_id_failed(invoke_id)) {
|
||||||
fprintf(stderr, "\rError: TSM Timeout!\r\n");
|
fprintf(stderr, "\rError: TSM Timeout!\r\n");
|
||||||
tsm_free_invoke_id(invoke_id);
|
tsm_free_invoke_id(invoke_id);
|
||||||
/* try again or abort? */
|
Error_Detected = true;
|
||||||
|
/* try again or abort? */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* increment timer - exit if timed out */
|
/* increment timer - exit if timed out */
|
||||||
elapsed_seconds += (current_seconds - last_seconds);
|
elapsed_seconds += (current_seconds - last_seconds);
|
||||||
if (elapsed_seconds > timeout_seconds) {
|
if (elapsed_seconds > timeout_seconds) {
|
||||||
|
Error_Detected = true;
|
||||||
printf("\rError: APDU Timeout!\r\n");
|
printf("\rError: APDU Timeout!\r\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -450,6 +452,6 @@ int main(int argc, char *argv[]) {
|
|||||||
/* keep track of time for next check */
|
/* keep track of time for next check */
|
||||||
last_seconds = current_seconds;
|
last_seconds = current_seconds;
|
||||||
}
|
}
|
||||||
|
if(Error_Detected) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user