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 | 380 | size_t sz = 0; |
381 | 381 | |
382 | 382 | if(!(lib3270_connected(hSession) && hSession->text)) |
383 | + { | |
384 | + errno = ENOTCONN; | |
383 | 385 | return NULL; |
386 | + } | |
384 | 387 | |
385 | 388 | ret = lib3270_malloc(buflen); |
386 | 389 | |
... | ... | @@ -406,6 +409,7 @@ static char * get_text(H3270 *hSession,unsigned char all) |
406 | 409 | if(!sz) |
407 | 410 | { |
408 | 411 | lib3270_free(ret); |
412 | + errno = ENOENT; | |
409 | 413 | return NULL; |
410 | 414 | } |
411 | 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 | 466 | CHECK_SESSION_HANDLE(h); |
463 | 467 | |
464 | 468 | if(!lib3270_connected(h)) |
469 | + { | |
470 | + errno = ENOTCONN; | |
465 | 471 | return NULL; |
472 | + } | |
466 | 473 | |
467 | 474 | maxlen = (h->rows * (h->cols+1)) - offset; |
468 | 475 | if(maxlen <= 0 || offset < 0) |
... | ... | @@ -505,10 +512,6 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) |
505 | 512 | LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len) |
506 | 513 | { |
507 | 514 | CHECK_SESSION_HANDLE(h); |
508 | - | |
509 | - if(!lib3270_connected(h)) | |
510 | - return NULL; | |
511 | - | |
512 | 515 | return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len); |
513 | 516 | } |
514 | 517 | ... | ... |