aboutsummaryrefslogtreecommitdiff
path: root/networking/telnetd.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-10-16 22:53:05 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-10-16 22:53:05 +0000
commit557613656317ccf401669dcc6681155bf2930c9f (patch)
tree4c1b64b064a304cf4aca3bc9696c6a962d677409 /networking/telnetd.c
parent23c8128916d9a40b473557a11d431549a94604f1 (diff)
downloadbusybox-w32-557613656317ccf401669dcc6681155bf2930c9f.tar.gz
busybox-w32-557613656317ccf401669dcc6681155bf2930c9f.tar.bz2
busybox-w32-557613656317ccf401669dcc6681155bf2930c9f.zip
fixes revealed by randomconfig run
Diffstat (limited to 'networking/telnetd.c')
-rw-r--r--networking/telnetd.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 8cadc6344..f1927e069 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -492,7 +492,11 @@ int telnetd_main(int argc, char **argv)
492 while (ts) { 492 while (ts) {
493 struct tsession *next = ts->next; /* in case we free ts. */ 493 struct tsession *next = ts->next; /* in case we free ts. */
494 if (ts->shell_pid == -1) { 494 if (ts->shell_pid == -1) {
495#if !ENABLE_FEATURE_TELNETD_STANDALONE
496 return 0;
497#else
495 free_session(ts); 498 free_session(ts);
499#endif
496 } else { 500 } else {
497 if (ts->size1 > 0) /* can write to pty */ 501 if (ts->size1 > 0) /* can write to pty */
498 FD_SET(ts->ptyfd, &wrfdset); 502 FD_SET(ts->ptyfd, &wrfdset);
@@ -552,8 +556,6 @@ int telnetd_main(int argc, char **argv)
552 if (count < 0) { 556 if (count < 0) {
553 if (errno == EAGAIN) 557 if (errno == EAGAIN)
554 goto skip1; 558 goto skip1;
555 if (IS_INETD)
556 return 0;
557 goto kill_session; 559 goto kill_session;
558 } 560 }
559 ts->size1 -= count; 561 ts->size1 -= count;
@@ -569,8 +571,6 @@ int telnetd_main(int argc, char **argv)
569 if (count < 0) { 571 if (count < 0) {
570 if (errno == EAGAIN) 572 if (errno == EAGAIN)
571 goto skip2; 573 goto skip2;
572 if (IS_INETD)
573 return 0;
574 goto kill_session; 574 goto kill_session;
575 } 575 }
576 ts->size2 -= count; 576 ts->size2 -= count;
@@ -601,8 +601,6 @@ int telnetd_main(int argc, char **argv)
601 if (count <= 0) { 601 if (count <= 0) {
602 if (count < 0 && errno == EAGAIN) 602 if (count < 0 && errno == EAGAIN)
603 goto skip3; 603 goto skip3;
604 if (IS_INETD)
605 return 0;
606 goto kill_session; 604 goto kill_session;
607 } 605 }
608 /* Ignore trailing NUL if it is there */ 606 /* Ignore trailing NUL if it is there */
@@ -622,8 +620,6 @@ int telnetd_main(int argc, char **argv)
622 if (count <= 0) { 620 if (count <= 0) {
623 if (count < 0 && errno == EAGAIN) 621 if (count < 0 && errno == EAGAIN)
624 goto skip4; 622 goto skip4;
625 if (IS_INETD)
626 return 0;
627 goto kill_session; 623 goto kill_session;
628 } 624 }
629 ts->size2 += count; 625 ts->size2 += count;
@@ -635,8 +631,14 @@ int telnetd_main(int argc, char **argv)
635 ts = next; 631 ts = next;
636 continue; 632 continue;
637 kill_session: 633 kill_session:
634#if !ENABLE_FEATURE_TELNETD_STANDALONE
635 return 0;
636#else
637 if (IS_INETD)
638 return 0;
638 free_session(ts); 639 free_session(ts);
639 ts = next; 640 ts = next;
641#endif
640 } 642 }
641 643
642 goto again; 644 goto again;