aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2022-09-15 10:31:50 -0800
committerDavid M. Syzdek <david@syzdek.net>2022-09-15 10:31:50 -0800
commit3b98763bd4531c71127b1debfe707882152623f4 (patch)
tree6c2557474a6337ecb4940a234f6611cb35ad8c27
parent6e9fb4c3bcdfd5c147b9549dc40a572fc6214082 (diff)
downloadbindletools-3b98763bd4531c71127b1debfe707882152623f4.tar.gz
bindletools-3b98763bd4531c71127b1debfe707882152623f4.tar.bz2
bindletools-3b98763bd4531c71127b1debfe707882152623f4.tar.xz
bindletools-3b98763bd4531c71127b1debfe707882152623f4.zip
bindletools: refactoring bindle_encodings_src_fileno()
-rw-r--r--src/widget-encodings.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/widget-encodings.c b/src/widget-encodings.c
index acc32b3..70de289 100644
--- a/src/widget-encodings.c
+++ b/src/widget-encodings.c
@@ -538,9 +538,11 @@ bindle_encodings_src_fileno(
538 state->line_off = 0; 538 state->line_off = 0;
539 buff = state->buff; 539 buff = state->buff;
540 540
541 while ((len = read(cnf->state->fdin, &buff[state->buff_len], (state->buff_size-state->buff_len))) > 0) 541 while ((len = read(cnf->state->fdin, &buff[state->buff_len], (state->buff_size-state->buff_len))) >= 0)
542 { 542 {
543 state->buff_len += (size_t)len; 543 state->buff_len += (size_t)len;
544 if (state->buff_len == 0)
545 return(0);
544 buff[state->buff_len] = '\0'; 546 buff[state->buff_len] = '\0';
545 if ((cnf->widget_flags & BINDLE_FLG_DECODE) == BINDLE_FLG_DECODE) 547 if ((cnf->widget_flags & BINDLE_FLG_DECODE) == BINDLE_FLG_DECODE)
546 { 548 {
@@ -551,7 +553,9 @@ bindle_encodings_src_fileno(
551 { 553 {
552 if (bindle_encodings_action_encode(cnf, method) == -1) 554 if (bindle_encodings_action_encode(cnf, method) == -1)
553 return(1); 555 return(1);
554 } 556 };
557 if (len == 0)
558 return(0);
555 }; 559 };
556 if (len == -1) 560 if (len == -1)
557 { 561 {