From 7a1870d564cfd99e370117a6e13d7fa05f0cdcf0 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 24 Apr 2019 09:34:41 -0300 Subject: [PATCH] Fixing segfault when user press enter on a locked terminal. --- src/lib3270/kybd.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib3270/kybd.c b/src/lib3270/kybd.c index 22f8927..4a04c5f 100644 --- a/src/lib3270/kybd.c +++ b/src/lib3270/kybd.c @@ -172,6 +172,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) // If typeahead disabled, complain and drop it. if (!hSession->typeahead) { + lib3270_ring_bell(hSession); lib3270_trace_event(hSession,"typeahead action dropped (no typeahead)\n"); return NULL; } @@ -206,7 +207,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) { struct ta *ta = new_ta(hSession, TA_TYPE_KEY_AID); - if(!ta) + if(ta) return; ta->args.aid_code = aid_code; @@ -241,11 +242,13 @@ void enq_action(H3270 *hSession, int (*fn)(H3270 *)) { struct ta *ta = new_ta(hSession, TA_TYPE_ACTION); - ta->args.action = fn; + if(!ta) + return; + ta->args.action = fn; lib3270_trace_event(hSession,"single action queued (kybdlock 0x%x)\n", hSession->kybdlock); -} +} /** * @brief Execute an action from the typeahead queue. @@ -442,10 +445,11 @@ static void operator_error(H3270 *hSession, int error_type) } } - -/* - * Handle an AID (Attention IDentifier) key. This is the common stuff that - * gets executed for all AID keys (PFs, PAs, Clear and etc). +/** + * @brief Handle an AID (Attention IDentifier) key. + * + * This is the common stuff that gets executed for all AID keys (PFs, PAs, Clear and etc). + * */ static void key_AID(H3270 *hSession, unsigned char aid_code) { -- libgit2 0.21.2