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:
brayra
2008-06-17 18:18:30 +00:00
parent f006765c94
commit 24e7c4c908
2 changed files with 9 additions and 4 deletions
+5 -2
View File
@@ -350,7 +350,8 @@ int main(int argc, char *argv[]) {
else if (tsm_invoke_id_failed(invoke_id)) {
fprintf(stderr, "\rError: TSM Timeout!\r\n");
tsm_free_invoke_id(invoke_id);
/* try again or abort? */
Error_Detected = true;
/* try again or abort? */
break;
}
} else {
@@ -358,12 +359,14 @@ int main(int argc, char *argv[]) {
elapsed_seconds += (current_seconds - last_seconds);
if (elapsed_seconds > timeout_seconds) {
printf("\rError: APDU Timeout!\r\n");
break;
Error_Detected = true;
break;
}
}
/* keep track of time for next check */
last_seconds = current_seconds;
}
if(Error_Detected) return 1;
return 0;
}
+4 -2
View File
@@ -436,13 +436,15 @@ int main(int argc, char *argv[]) {
else if (tsm_invoke_id_failed(invoke_id)) {
fprintf(stderr, "\rError: TSM Timeout!\r\n");
tsm_free_invoke_id(invoke_id);
/* try again or abort? */
Error_Detected = true;
/* try again or abort? */
break;
}
} else {
/* increment timer - exit if timed out */
elapsed_seconds += (current_seconds - last_seconds);
if (elapsed_seconds > timeout_seconds) {
Error_Detected = true;
printf("\rError: APDU Timeout!\r\n");
break;
}
@@ -450,6 +452,6 @@ int main(int argc, char *argv[]) {
/* keep track of time for next check */
last_seconds = current_seconds;
}
if(Error_Detected) return 1;
return 0;
}