summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2020-09-25 10:56:36 +0000
committertb <>2020-09-25 10:56:36 +0000
commit6ba93d157a89d62d92a41e3dad8428d9d5876a6b (patch)
tree0208690df2f95a33fbc6a460757232afaef1f5dc
parent8e9a70b045dcd6535fbf6face9bb2d307f5d3be9 (diff)
downloadopenbsd-6ba93d157a89d62d92a41e3dad8428d9d5876a6b.tar.gz
openbsd-6ba93d157a89d62d92a41e3dad8428d9d5876a6b.tar.bz2
openbsd-6ba93d157a89d62d92a41e3dad8428d9d5876a6b.zip
Move variable declaration to the top of UI_set_result and ditch
a pointless local scope. suggested by jsing
-rw-r--r--src/lib/libcrypto/ui/ui_lib.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c
index 106a38fa8a..1e3a4ee705 100644
--- a/src/lib/libcrypto/ui/ui_lib.c
+++ b/src/lib/libcrypto/ui/ui_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ui_lib.c,v 1.40 2020/09/25 10:50:26 tb Exp $ */ 1/* $OpenBSD: ui_lib.c,v 1.41 2020/09/25 10:56:36 tb Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -775,6 +775,7 @@ UI_get_result_maxsize(UI_STRING *uis)
775int 775int
776UI_set_result(UI *ui, UI_STRING *uis, const char *result) 776UI_set_result(UI *ui, UI_STRING *uis, const char *result)
777{ 777{
778 const char *p;
778 int l = strlen(result); 779 int l = strlen(result);
779 780
780 ui->flags &= ~UI_FLAG_REDOABLE; 781 ui->flags &= ~UI_FLAG_REDOABLE;
@@ -810,25 +811,21 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result)
810 uis->_.string_data.result_maxsize + 1); 811 uis->_.string_data.result_maxsize + 1);
811 break; 812 break;
812 case UIT_BOOLEAN: 813 case UIT_BOOLEAN:
813 { 814 if (!uis->result_buf) {
814 const char *p; 815 UIerror(UI_R_NO_RESULT_BUFFER);
815 816 return -1;
816 if (!uis->result_buf) { 817 }
817 UIerror(UI_R_NO_RESULT_BUFFER); 818 uis->result_buf[0] = '\0';
818 return -1; 819 for (p = result; *p; p++) {
820 if (strchr(uis->_.boolean_data.ok_chars, *p)) {
821 uis->result_buf[0] =
822 uis->_.boolean_data.ok_chars[0];
823 break;
819 } 824 }
820 uis->result_buf[0] = '\0'; 825 if (strchr(uis->_.boolean_data.cancel_chars, *p)) {
821 for (p = result; *p; p++) { 826 uis->result_buf[0] =
822 if (strchr(uis->_.boolean_data.ok_chars, *p)) { 827 uis->_.boolean_data.cancel_chars[0];
823 uis->result_buf[0] = 828 break;
824 uis->_.boolean_data.ok_chars[0];
825 break;
826 }
827 if (strchr(uis->_.boolean_data.cancel_chars, *p)) {
828 uis->result_buf[0] =
829 uis->_.boolean_data.cancel_chars[0];
830 break;
831 }
832 } 829 }
833 } 830 }
834 default: 831 default: