Commit 6282c7349de2298754eb998422faa52e355f9fe2

Authored by Perry Werneck
1 parent 9f063275

De: joão paulo limberger (shoo) para pw3270

Data: 28/01/2016 09:22
Assunto: PW3270 - Segmentation Fault ao informar parâmetro -t / --systype

Olá, trabalho com z/VM e gostaria de setar por default o tipo do sistema no servidor para VM/CMS... Mas está resultando falha de segmentação.

A solução aparentemente é somente as alteraçõezinhas do anexo..
src/lib3270/options.c
... ... @@ -168,7 +168,7 @@ LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, const char *name)
168 168  
169 169 for(f=0;f<(sizeof(host_type)/sizeof(host_type[0]));f++)
170 170 {
171   - if(!strcasecmp(host_type[f].name,name))
  171 + if(host_type[f].name && !strcasecmp(host_type[f].name,name))
172 172 {
173 173 hSession->options &= ~LIB3270_OPTION_HOST_TYPE;
174 174 hSession->options |= host_type[f].option;
... ...
src/pw3270/main.c
... ... @@ -405,7 +405,7 @@ int main(int argc, char *argv[])
405 405 { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), PACKAGE_NAME },
406 406 { "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), NULL },
407 407 { "colors", 'c', 0, G_OPTION_ARG_CALLBACK, optcolors, N_( "Set reported colors (8/16)" ), "16" },
408   - { "systype", 't', 0, G_OPTION_ARG_STRING, &system, N_( "Host system type" ), "S390" },
  408 + { "systype", 't', 0, G_OPTION_ARG_STRING, &systype, N_( "Host system type" ), "S390" },
409 409 { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL },
410 410 { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL },
411 411 { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL },
... ...
src/pw3270/window.c
... ... @@ -200,7 +200,7 @@
200 200  
201 201 if(systype)
202 202 {
203   - set_string_to_config("host","uri","%s",systype);
  203 + set_string_to_config("host","systype","%s",systype);
204 204 pw3270_set_host_type(widget,systype);
205 205 }
206 206 else
... ...