diff --git a/src/core/wait.c b/src/core/wait.c index d483a1e..e46975b 100644 --- a/src/core/wait.c +++ b/src/core/wait.c @@ -248,16 +248,22 @@ LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H327 // Timeout! The timer was destroyed. debug("%s exits with ETIMEDOUT",__FUNCTION__); errno = ETIMEDOUT; - return (LIB3270_KEYBOARD_LOCK_STATE) hSession->kybdlock; + break; } - if(lib3270_is_disconnected(hSession)) + if(hSession->kybdlock == LIB3270_KL_NOT_CONNECTED) { errno = ENOTCONN; break; } if(KYBDLOCK_IS_OERR(hSession)) + { + errno = EPERM; + break; + } + + if(hSession->kybdlock == LIB3270_KL_UNLOCKED) break; debug("%s: Waiting",__FUNCTION__); diff --git a/src/include/lib3270/keyboard.h b/src/include/lib3270/keyboard.h index d42955c..366b9a0 100644 --- a/src/include/lib3270/keyboard.h +++ b/src/include/lib3270/keyboard.h @@ -66,6 +66,8 @@ * @param seconds Number of seconds to wait. * * @return keyboard lock status. + * + * @retval LIB3270_KL_UNLOCKED Keyboard unlocked, acess ok. */ LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H3270 *hSession, int seconds); -- libgit2 0.21.2