Solution found! :-) In short, we have to set the C flag PTY_ZEROREAD in the configure phase of the compilation.
In the channels.c file of te source code we can see where the error is thrown ,,,...
#ifndef PTY_ZEROREAD
if (len <= 0) {
#else
if ((!c->isatty && len <= 0) ||
(c->isatty && (len < 0 || (len == 0 && errno != 0)))) {
#endif
debug2("channel %d: read<=0 rfd %d len %zd",
c->self, c->rfd, len);
if (c->type != SSH_CHANNEL_OPEN) {
debug2("channel %d: not open", c->self);
chan_mark_dead(ssh, c);
return -1;
} else {
chan_read_failed(ssh, c);
}
return -1;
}
And we can see that the compilation flag PTY_ZEROREAD changes how the zero length messages are treated in terminals.
To solve the problem the configure command has to be done with the C flag set as shown in the last line of the following command:
./configure --with-zlib \
--with-pam \
--with-md5-passwords \
CFLAGS="-DPTY_ZEROREAD=1"