Commit 6b1178c20fe3c023e6d40609a63fd908ae8a9bd1
1 parent
40c509b9
Exists in
master
and in
3 other branches
Fixing segfault on lib3270.
Showing
3 changed files
with
29 additions
and
22 deletions
Show diff stats
src/lib3270/linux/connect.c
| @@ -198,7 +198,13 @@ static void net_connected(H3270 *hSession, int fd unused, LIB3270_IO_FLAG flag u | @@ -198,7 +198,13 @@ static void net_connected(H3270 *hSession, int fd unused, LIB3270_IO_FLAG flag u | ||
| 198 | if(!(hSession->host.current && hSession->host.srvc)) | 198 | if(!(hSession->host.current && hSession->host.srvc)) |
| 199 | { | 199 | { |
| 200 | // No host info, try the default one. | 200 | // No host info, try the default one. |
| 201 | - lib3270_set_url(hSession,NULL); | 201 | + if(lib3270_set_url(hSession,NULL)) |
| 202 | + { | ||
| 203 | + int err = errno; | ||
| 204 | + lib3270_trace_event(hSession,"Can't set default URL (%s)\n",strerror(err)); | ||
| 205 | + return errno = err; | ||
| 206 | + } | ||
| 207 | + | ||
| 202 | if(!(hSession->host.current && hSession->host.srvc)) | 208 | if(!(hSession->host.current && hSession->host.srvc)) |
| 203 | { | 209 | { |
| 204 | return errno = ENOENT; | 210 | return errno = ENOENT; |
src/lib3270/properties.c
| @@ -66,21 +66,21 @@ | @@ -66,21 +66,21 @@ | ||
| 66 | static const LIB3270_INT_PROPERTY properties[] = { | 66 | static const LIB3270_INT_PROPERTY properties[] = { |
| 67 | { | 67 | { |
| 68 | "ready", // Property name. | 68 | "ready", // Property name. |
| 69 | - N_( "" ), // Property description. | 69 | + N_( "Is terminal ready" ), // Property description. |
| 70 | lib3270_is_ready, // Get value. | 70 | lib3270_is_ready, // Get value. |
| 71 | NULL // Set value. | 71 | NULL // Set value. |
| 72 | }, | 72 | }, |
| 73 | 73 | ||
| 74 | { | 74 | { |
| 75 | "connected", // Property name. | 75 | "connected", // Property name. |
| 76 | - N_( "" ), // Property description. | 76 | + N_( "Is terminal connected" ), // Property description. |
| 77 | lib3270_is_connected, // Get value. | 77 | lib3270_is_connected, // Get value. |
| 78 | NULL // Set value. | 78 | NULL // Set value. |
| 79 | }, | 79 | }, |
| 80 | 80 | ||
| 81 | { | 81 | { |
| 82 | "secure", // Property name. | 82 | "secure", // Property name. |
| 83 | - N_( "" ), // Property description. | 83 | + N_( "Is connection secure" ), // Property description. |
| 84 | lib3270_is_secure, // Get value. | 84 | lib3270_is_secure, // Get value. |
| 85 | NULL // Set value. | 85 | NULL // Set value. |
| 86 | }, | 86 | }, |
| @@ -101,28 +101,28 @@ | @@ -101,28 +101,28 @@ | ||
| 101 | 101 | ||
| 102 | { | 102 | { |
| 103 | "pconnected", // Property name. | 103 | "pconnected", // Property name. |
| 104 | - N_( "" ), // Property description. | 104 | + "", // Property description. |
| 105 | lib3270_pconnected, // Get value. | 105 | lib3270_pconnected, // Get value. |
| 106 | NULL // Set value. | 106 | NULL // Set value. |
| 107 | }, | 107 | }, |
| 108 | 108 | ||
| 109 | { | 109 | { |
| 110 | - "half_connected", // Property name. | ||
| 111 | - N_( "" ), // Property description. | ||
| 112 | - lib3270_half_connected, // Get value. | ||
| 113 | - NULL // Set value. | 110 | + "half_connected", // Property name. |
| 111 | + "", // Property description. | ||
| 112 | + lib3270_half_connected, // Get value. | ||
| 113 | + NULL // Set value. | ||
| 114 | }, | 114 | }, |
| 115 | 115 | ||
| 116 | { | 116 | { |
| 117 | "neither", // Property name. | 117 | "neither", // Property name. |
| 118 | - N_( "" ), // Property description. | 118 | + "", // Property description. |
| 119 | lib3270_in_neither, // Get value. | 119 | lib3270_in_neither, // Get value. |
| 120 | NULL // Set value. | 120 | NULL // Set value. |
| 121 | }, | 121 | }, |
| 122 | 122 | ||
| 123 | { | 123 | { |
| 124 | "ansi", // Property name. | 124 | "ansi", // Property name. |
| 125 | - N_( "" ), // Property description. | 125 | + "", // Property description. |
| 126 | lib3270_in_ansi, // Get value. | 126 | lib3270_in_ansi, // Get value. |
| 127 | NULL // Set value. | 127 | NULL // Set value. |
| 128 | }, | 128 | }, |
| @@ -136,14 +136,14 @@ | @@ -136,14 +136,14 @@ | ||
| 136 | 136 | ||
| 137 | { | 137 | { |
| 138 | "sscp", // Property name. | 138 | "sscp", // Property name. |
| 139 | - N_( "" ), // Property description. | 139 | + "", // Property description. |
| 140 | lib3270_in_sscp, // Get value. | 140 | lib3270_in_sscp, // Get value. |
| 141 | NULL // Set value. | 141 | NULL // Set value. |
| 142 | }, | 142 | }, |
| 143 | 143 | ||
| 144 | { | 144 | { |
| 145 | "tn3270e", // Property name. | 145 | "tn3270e", // Property name. |
| 146 | - N_( "" ), // Property description. | 146 | + "", // Property description. |
| 147 | lib3270_in_tn3270e, // Get value. | 147 | lib3270_in_tn3270e, // Get value. |
| 148 | NULL // Set value. | 148 | NULL // Set value. |
| 149 | }, | 149 | }, |
| @@ -179,7 +179,7 @@ | @@ -179,7 +179,7 @@ | ||
| 179 | /* | 179 | /* |
| 180 | { | 180 | { |
| 181 | "", // Property name. | 181 | "", // Property name. |
| 182 | - N_( "" ), // Property description. | 182 | + "", // Property description. |
| 183 | NULL, // Get value. | 183 | NULL, // Get value. |
| 184 | NULL // Set value. | 184 | NULL // Set value. |
| 185 | }, | 185 | }, |
| @@ -268,7 +268,7 @@ | @@ -268,7 +268,7 @@ | ||
| 268 | /* | 268 | /* |
| 269 | { | 269 | { |
| 270 | "", // Property name. | 270 | "", // Property name. |
| 271 | - N_( "" ), // Property description. | 271 | + "", // Property description. |
| 272 | NULL, // Get value. | 272 | NULL, // Get value. |
| 273 | NULL // Set value. | 273 | NULL // Set value. |
| 274 | }, | 274 | }, |
| @@ -444,7 +444,7 @@ | @@ -444,7 +444,7 @@ | ||
| 444 | /* | 444 | /* |
| 445 | { | 445 | { |
| 446 | "", // Property name. | 446 | "", // Property name. |
| 447 | - N_( "" ), // Property description. | 447 | + "", // Property description. |
| 448 | , // Get value. | 448 | , // Get value. |
| 449 | NULL // Set value. | 449 | NULL // Set value. |
| 450 | }, | 450 | }, |
src/lib3270/testprogram/testprogram.c
| @@ -73,13 +73,14 @@ int main(int argc, char *argv[]) | @@ -73,13 +73,14 @@ int main(int argc, char *argv[]) | ||
| 73 | lib3270_set_toggle(h,LIB3270_TOGGLE_SSL_TRACE,1); | 73 | lib3270_set_toggle(h,LIB3270_TOGGLE_SSL_TRACE,1); |
| 74 | 74 | ||
| 75 | rc = lib3270_reconnect(h,120); | 75 | rc = lib3270_reconnect(h,120); |
| 76 | - printf("\nConnect %s exits with rc=%d\n",lib3270_get_url(h),rc); | 76 | + printf("\nConnect exits with rc=%d\n",rc); |
| 77 | 77 | ||
| 78 | - lib3270_wait_for_ready(h,10); | ||
| 79 | - | ||
| 80 | - lib3270_enter(h); | ||
| 81 | - | ||
| 82 | - lib3270_wait_for_ready(h,10); | 78 | + if(!rc) |
| 79 | + { | ||
| 80 | + lib3270_wait_for_ready(h,10); | ||
| 81 | + lib3270_enter(h); | ||
| 82 | + lib3270_wait_for_ready(h,10); | ||
| 83 | + } | ||
| 83 | 84 | ||
| 84 | lib3270_session_free(h); | 85 | lib3270_session_free(h); |
| 85 | 86 |