telnet: do not check for 0 return from poll (it's impossible)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-10-29 02:33:38 +02:00
parent 036dbb9d9a
commit ec07420eb9

View File

@ -603,21 +603,22 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
signal(SIGINT, record_signo); signal(SIGINT, record_signo);
ufds[0].fd = 0; ufds[1].fd = netfd; ufds[0].fd = STDIN_FILENO;
ufds[0].events = ufds[1].events = POLLIN; ufds[0].events = POLLIN;
ufds[1].fd = netfd;
ufds[1].events = POLLIN;
while (1) { while (1) {
switch (poll(ufds, 2, -1)) { if (poll(ufds, 2, -1) < 0) {
case 0:
/* timeout */
case -1:
/* error, ignore and/or log something, bay go to loop */ /* error, ignore and/or log something, bay go to loop */
if (bb_got_signal) if (bb_got_signal)
con_escape(); con_escape();
else else
sleep(1); sleep(1);
break; continue;
default: }
// FIXME: reads can block. Need full bidirectional buffering.
if (ufds[0].revents) { if (ufds[0].revents) {
len = safe_read(STDIN_FILENO, G.buf, DATABUFSIZE); len = safe_read(STDIN_FILENO, G.buf, DATABUFSIZE);
@ -636,6 +637,5 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
TRACE(0, ("Read netfd (%d): %d\n", netfd, len)); TRACE(0, ("Read netfd (%d): %d\n", netfd, len));
handle_net_input(len); handle_net_input(len);
} }
}
} /* while (1) */ } /* while (1) */
} }