Commit 97072052106c4c2a6a6d6325b8ee85e9c11b7eac

Authored by Perry Werneck
1 parent e77787ad

lib3270_disconnect returns a valid rc in case of error.

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
src/lib3270/host.c
... ... @@ -93,7 +93,8 @@ int host_disconnect(H3270 *hSession, int failed)
93 93 net_disconnect(hSession);
94 94  
95 95 trace("Disconnected (Failed: %d Reconnect: %d in_progress: %d)",failed,lib3270_get_toggle(hSession,LIB3270_TOGGLE_RECONNECT),hSession->auto_reconnect_inprogress);
96   - if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_RECONNECT) && !hSession->auto_reconnect_inprogress)
  96 +
  97 + if(failed && lib3270_get_toggle(hSession,LIB3270_TOGGLE_RECONNECT) && !hSession->auto_reconnect_inprogress)
97 98 {
98 99 /* Schedule an automatic reconnection. */
99 100 hSession->auto_reconnect_inprogress = 1;
... ... @@ -115,8 +116,7 @@ int host_disconnect(H3270 *hSession, int failed)
115 116  
116 117 }
117 118  
118   - errno = ENOTCONN;
119   - return -1;
  119 + return errno = ENOTCONN;
120 120  
121 121 }
122 122  
... ...