For the UI functions that return an int, 0 or any positive number is a
success return, any negative number is a failure. Make sure we check the return value with that in mind.
This commit is contained in:
parent
429266b7e4
commit
20e8f0ee27
@ -1211,7 +1211,7 @@ static int hwcrhk_insert_card(const char *prompt_info,
|
|||||||
BIO_snprintf(buf, sizeof(buf)-1,
|
BIO_snprintf(buf, sizeof(buf)-1,
|
||||||
"Current card: \"%s\"\n", wrong_info);
|
"Current card: \"%s\"\n", wrong_info);
|
||||||
ok = UI_dup_info_string(ui, buf);
|
ok = UI_dup_info_string(ui, buf);
|
||||||
if (ok && prompt_info)
|
if (ok >= 0 && prompt_info)
|
||||||
{
|
{
|
||||||
BIO_snprintf(buf, sizeof(buf)-1,
|
BIO_snprintf(buf, sizeof(buf)-1,
|
||||||
"Insert card \"%s\"\n then hit <enter> or C<enter> to cancel\n", prompt_info);
|
"Insert card \"%s\"\n then hit <enter> or C<enter> to cancel\n", prompt_info);
|
||||||
@ -1219,13 +1219,13 @@ static int hwcrhk_insert_card(const char *prompt_info,
|
|||||||
answer, 0, sizeof(answer)-1);
|
answer, 0, sizeof(answer)-1);
|
||||||
}
|
}
|
||||||
UI_add_user_data(ui, callback_data);
|
UI_add_user_data(ui, callback_data);
|
||||||
if (ok)
|
if (ok >= 0)
|
||||||
ok = UI_process(ui);
|
ok = UI_process(ui);
|
||||||
UI_free(ui);
|
UI_free(ui);
|
||||||
/* If canceled input treat as 'cancel' */
|
/* If canceled input treat as 'cancel' */
|
||||||
if (ok == -2)
|
if (ok == -2)
|
||||||
ok = 1;
|
ok = 1;
|
||||||
else if(ok != 0)
|
else if(ok < 0)
|
||||||
ok = -1;
|
ok = -1;
|
||||||
else if (answer[0] == 'c' || answer[0] == 'C')
|
else if (answer[0] == 'c' || answer[0] == 'C')
|
||||||
ok = 1;
|
ok = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user