Commit b2a898de8e79fd2ae01383a22216d616fd8569da
1 parent
e4acf79f
Exists in
master
and in
3 other branches
Preparando para empacotamento do plugin dbus
Showing
1 changed file
with
7 additions
and
4 deletions
Show diff stats
selection.c
@@ -380,7 +380,10 @@ static char * get_text(H3270 *hSession,unsigned char all) | @@ -380,7 +380,10 @@ static char * get_text(H3270 *hSession,unsigned char all) | ||
380 | size_t sz = 0; | 380 | size_t sz = 0; |
381 | 381 | ||
382 | if(!(lib3270_connected(hSession) && hSession->text)) | 382 | if(!(lib3270_connected(hSession) && hSession->text)) |
383 | + { | ||
384 | + errno = ENOTCONN; | ||
383 | return NULL; | 385 | return NULL; |
386 | + } | ||
384 | 387 | ||
385 | ret = lib3270_malloc(buflen); | 388 | ret = lib3270_malloc(buflen); |
386 | 389 | ||
@@ -406,6 +409,7 @@ static char * get_text(H3270 *hSession,unsigned char all) | @@ -406,6 +409,7 @@ static char * get_text(H3270 *hSession,unsigned char all) | ||
406 | if(!sz) | 409 | if(!sz) |
407 | { | 410 | { |
408 | lib3270_free(ret); | 411 | lib3270_free(ret); |
412 | + errno = ENOENT; | ||
409 | return NULL; | 413 | return NULL; |
410 | } | 414 | } |
411 | else if(sz > 1 && ret[sz-1] == '\n') // Remove ending \n | 415 | else if(sz > 1 && ret[sz-1] == '\n') // Remove ending \n |
@@ -462,7 +466,10 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -462,7 +466,10 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
462 | CHECK_SESSION_HANDLE(h); | 466 | CHECK_SESSION_HANDLE(h); |
463 | 467 | ||
464 | if(!lib3270_connected(h)) | 468 | if(!lib3270_connected(h)) |
469 | + { | ||
470 | + errno = ENOTCONN; | ||
465 | return NULL; | 471 | return NULL; |
472 | + } | ||
466 | 473 | ||
467 | maxlen = (h->rows * (h->cols+1)) - offset; | 474 | maxlen = (h->rows * (h->cols+1)) - offset; |
468 | if(maxlen <= 0 || offset < 0) | 475 | if(maxlen <= 0 || offset < 0) |
@@ -505,10 +512,6 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -505,10 +512,6 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
505 | LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len) | 512 | LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len) |
506 | { | 513 | { |
507 | CHECK_SESSION_HANDLE(h); | 514 | CHECK_SESSION_HANDLE(h); |
508 | - | ||
509 | - if(!lib3270_connected(h)) | ||
510 | - return NULL; | ||
511 | - | ||
512 | return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len); | 515 | return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len); |
513 | } | 516 | } |
514 | 517 |