Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rick From: rick@seismo.CSS.GOV (Rick Adams) Newsgroups: net.bugs.4bsd Subject: 4.3 BSD telnet can get into infinite loop Message-ID: <41296@beno.seismo.CSS.GOV> Date: Fri, 15-Aug-86 16:40:16 EDT Article-I.D.: beno.41296 Posted: Fri Aug 15 16:40:16 1986 Date-Received: Sun, 17-Aug-86 06:13:02 EDT Sender: news@seismo.CSS.GOV Organization: Center for Seismic Studies, Arlington, VA Lines: 114 Keywords: telnet eof Subject: telnet can infinite loop if eof on input Index: ucb/telnet.c 4.3BSD Description: 1) telnet should exit non-zero if connect failed this is useful for shell scripts if you want to test if a host is up 2) telnet can go into an infinite loop if stdin returns EOF Repeat-By: 1) grep exit() telnet.c 2) telnet localhosts 4) ! quit(); ! } else ! neofs = 0; ! if (c <= 0) { tcc = c; break; *************** *** 1980,1986 **** quit() { (void) call(bye, "bye", 0); ! exit(0); /*NOTREACHED*/ } --- 1984,1990 ---- quit() { (void) call(bye, "bye", 0); ! exit(didconnect ? 0 : 1); /*NOTREACHED*/ } *************** *** 2115,2120 **** --- 2119,2125 ---- return 0; } connected++; + didconnect++; } while (connected == 0); call(status, "status", "notmuch", 0); if (setjmp(peerdied) == 0) *************** *** 2355,2361 **** } if (argc != 1) { if (setjmp(toplevel) != 0) ! exit(0); tn(argc, argv); } setjmp(toplevel); --- 2360,2366 ---- } if (argc != 1) { if (setjmp(toplevel) != 0) ! exit(didconnect ? 0 : 1); tn(argc, argv); } setjmp(toplevel);